• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
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?
 
Author and ninkuma
Marshal
Posts: 66692
167
IntelliJ IDE Java jQuery Mac Mac OS X
  • 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: 4869
136
Chrome Eclipse IDE Java Postgres Database VI Editor
  • 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: 3067
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?
 
Rancher
Posts: 3498
39
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!