This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Grokking Bitcoin and have Kalle Rosenbaum on-line!
See this thread for details.
Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization forum!
  • 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
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

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?
 
Marshal
Posts: 67256
170
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: 5919
155
Chrome Eclipse IDE Java Postgres Database Ubuntu 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: 3353
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: 4032
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.
 
No one can make you feel inferior without your consent - Eleanor Roosevelt. tiny ad:
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!