-1

i have been searching for a while to find this question, and i have certainly found this question asked before, but the answers have not worked for me.

to give a little information about what i am trying to achieve: i am trying to apply for a job that says "wow us with your cover letter and guarantee a response," so i decided to make a very very simple program that uses what little knowledge i have to interact with the person and work in my cover letter. i have a bit of the program written and realized that i do not know how to make the program run outside of eclipse. furthermore, i need to make sure that it is something that will work on another computer, which is not likely going to be a mac.

i have already tried to export as an executable jar file, which gave me a .class file. that will not open - it gives an error telling me to check the console for possible errors. i already have jre installed and jdk. i also tried downloading other apps that i was led to in my search for an answer, such as jsmooth (not realizing it is only for windows) and lingon. i'm pretty sure those are not at all what i am really looking for.

i am trying really hard to not contribute to another duplicate question, but i can't seem to find the answer i'm looking for.

another thought - i am trying to make it executable by double clicking the icon, just the same as i would expect any other application to do. i say that because i am hoping to be able to avoid going through the back door with terminal or the console, because that is something with which i have no experience.

this is one question i found that is very similar: how can I create executable file for the program written on Java?

i tried using java web start with the same lack of results. also, the writer of this question is asking for help with windows.

How can I open Java .class files in a human-readable way?

this one doesn't appear to be for a running a program, but for reading the code.

JAR file not opening on a Mac

this one is the most similar to what i am asking and the writer of the question was seeing what i am seeing in the warning, but this is from 2009 and it doesn't make sense to me.

sorry to go on like this, but i am trying to make it clear that i have tried to figure this out on my own and am running into a wall.

any help would be much appreciated!

Community
  • 1
  • 1
  • [Java Tutorial: Packaging Programs in JAR Files](http://docs.oracle.com/javase/tutorial/deployment/jar/index.html). – Oleg Estekhin Jul 14 '14 at 06:23
  • I just made a class that makes it easy to enable double-click start for Java console applications, but this only works on Windows so far. It is prepared to support other systems, but I don't know the command line stuff. Maybe you can add the one line (or so) that's needed and make it work for you. If so, please tell me so that I can extend it. http://stackoverflow.com/a/32547250/3500521 – Dreamspace President Sep 13 '15 at 08:14

1 Answers1

0

If you have a jar file already, try to run

java -jar yourfile.jar

in the terminal from the folder the jar file is located in. If you dont have a .jar yet, try to run

jar cf insertfilenameyouwanthere.jar C:\insert\path\of\project\here

and then do the above.

EDIT: Blimey the commentor is right the second one was a windows command. The mac one should be like

jar cmf MANIFEST.MF myjarfilename *.class

where you use the class file you have to get a jar from it.

  • You answer contains the windows-like path, while the question is very specifically stated that it is about the Mac (probably the latest model too). – Oleg Estekhin Jul 14 '14 at 06:26
  • @peeroverbeck what does that mean "where you use the class file you have to get a jar from it?" also, when you talk about the command, are you referring to me using the terminal? is there no way to make the icon clickable to run? – tylerandrewandersen Jul 14 '14 at 15:45
  • Sorry for late answer. I mean with my last line that you use the class file you already have and insert it where "*.class" is in the command. Yeah, I was talking about the terminal. I know that on Windows and Linux you can make the resulting jars clickable Icons on your Desktop by just setting the JRE as default execution program, but TBH I have no idea how this works on mac. – Peer Overbeck Jul 17 '14 at 20:19