Author | Message |
---|---|
RandomAccess
Posts: 101
|
Posted 16:21 Sep 22, 2017 |
Hey, I'm having trouble opening the .jar file for lab 4. For some reason nothing happens when I double click it. I looked up a few tutorials online, and from that decided to create a .txt file that I converted to a .cmd file to run the jar for me, but when I opened it the command line opens then immediately closes before any text can load. The actual program works fine on eclipse, so I can't imagine what's going on. I'd really appreciate some help. Attached below are all the files used in Lab 4. |
mcmalfaro
Posts: 13
|
Posted 16:37 Sep 22, 2017 |
Since you did not use JOptionPane, nothing will happen when you double click the jar file. In order to run your jar file open cmd and type the following: java -jar <javafilename>.jar |
RandomAccess
Posts: 101
|
Posted 16:43 Sep 22, 2017 |
It says it can't find the file |
mcmalfaro
Posts: 13
|
Posted 16:50 Sep 22, 2017 |
On mine when I open cmd it begins on this folder C:\Users\alfaro... Copy the address that appears on YOUR cmd and find the folder. Once you find it, copy your jar file on that folder. Go back to cmd and execute the command again. I hope you get what I am saying lol. |
RandomAccess
Posts: 101
|
Posted 16:59 Sep 22, 2017 |
Still not working, I copied it into C:\Users\aruma, which is what the command prompt is set to, and it still doesn't work. |
mcmalfaro
Posts: 13
|
Posted 17:34 Sep 22, 2017 |
I have no idea what you are doing wrong becuase I just run your program in my cmd after copying your java files and creating a jar file from them. It runs just fine. Make sure you have the jar file on the folder that cmd searches for. Also make sure to execute the code right. Ex. C:\Users\mcmal> java -jar javalab4.jar |
RandomAccess
Posts: 101
|
Posted 17:53 Sep 22, 2017 |
Just to be sure, I'm supposed to save it in the aruma folder correct? The last folder at the end of C:\Users\aruma>? |
mcmalfaro
Posts: 13
|
Posted 17:56 Sep 22, 2017 |
yes. save your executable jar file there. You don't need any other file just the jar file created when you export the project from eclipse |
RandomAccess
Posts: 101
|
Posted 18:02 Sep 22, 2017 |
Oh good, I just found out what was wrong. I was typing the name of the file in between the "<>" and I just found out that was part of your file name rather than part of the command prompt. That was silly of me. Thanks for the help, really appreciate it. I'm gonna go test this now. |
RandomAccess
Posts: 101
|
Posted 18:05 Sep 22, 2017 |
One more question. Will the teacher automatically be using the command prompt for these types of files, do we have to tell him to do it, or does he expect the .jar file to be activated once you click it? |
mcmalfaro
Posts: 13
|
Posted 18:10 Sep 22, 2017 |
I think he uses cmd to execute the files since he said that we could use either Scanner I/O or JOptionPane. Either way, just to make sure, you should talk to the TA since he is the one grading the labs. |
RandomAccess
Posts: 101
|
Posted 19:11 Sep 22, 2017 |
Know how I could contact him? I seem to be having trouble getting his information. |
mcmalfaro
Posts: 13
|
Posted 19:52 Sep 22, 2017 |
No. Just contact the prof. and he will let u know what to do |
RandomAccess
Posts: 101
|
Posted 20:11 Sep 22, 2017 |
That's...just what I said I couldn't do. Any emails or phone numbers? |
mcmalfaro
Posts: 13
|
Posted 20:16 Sep 22, 2017 |
jhurley2@calstatela.edu that's the instructor's email |
RandomAccess
Posts: 101
|
Posted 20:32 Sep 22, 2017 |
Thanks |