• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

How to run my java jar file in MAC OS X terminal

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using MAC OS X terminal to connect via SSH with my vm in AWS. I am successfully connected from terminal to EC2 instance but now i want to run my java application.

I am using both of these commands and none of them seems to work for me.


javac -classpath . Audit.jar MainClass.TestShamirScheme 6 3
//  javac command not found


java -cp . Audit.jar MainClass.TestShamirScheme 6 3
// could not find or load MainClass.TestShamirScheme

Is something i am doing wrong here?
 
Marshal
Posts: 67279
170
Mac Mac OS X IntelliJ IDE jQuery Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is Java installed on your VM? It doesn't matter if it's installed on your Mac or not for this.
 
barlet south
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Bear Bibeault yes it is installed since i run it before from my windows pc , with macbook pro it is not working
 
Sheriff
Posts: 6171
163
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

// javac command not found


If javac was not found, perhaps you installed the JRE instead of the JDK?  Or maybe the PATH environment variable doesn't point to the JDK bin directory?
 
Rancher
Posts: 3412
33
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

java -cp . Audit.jar MainClass.TestShamirScheme 6 3
// could not find or load MainClass.TestShamirScheme  


The results of that command would say there is a java command available and that it can not find the class named in the method.

I don't know the path separator for a MAC.  On Windows the path with the -cp option to have the current directory and the jar file on the classpath would be:
-cp .;Audit.jar

Is the TestShamirScheme.class file in the MainClass folder in the jar?
 
Master Rancher
Posts: 4216
47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has nothing to do with MacOSX at all, unless that is the OS on your VM.

barlet south wrote:
javac -classpath . Audit.jar MainClass.TestShamirScheme 6 3
//  javac command not found



That command is for compiling.
At least the javac part is.
It is not for executing java code, so you can ignore this issue as it isn't an issue.

barlet south wrote:
java -cp . Audit.jar MainClass.TestShamirScheme 6 3
// could not find or load MainClass.TestShamirScheme



As Norm says, the classpath here seems wrong.
What is the directory this command is being issued on?
Indeed, what is the VM OS?
That will determine what the class path separator looks like.
 
A day job? In an office? My worst nightmare! Comfort me tiny ad!
create, convert, edit or print DOC and DOCX in Java
https://products.aspose.com/words/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!