Computer Science Canada Code working in Eclipse but not in Sublime Text |
Author: | chromium [ Thu Mar 13, 2014 1:07 pm ] | ||||
Post subject: | Code working in Eclipse but not in Sublime Text | ||||
Hi Im trying to get java to run properly in Sublime Text. I have the following code, which seems valid to me:
It runs fine in Eclipse but when I try to run in Sublime Text I get this error:
Anyone know why? |
Author: | Raknarg [ Thu Mar 13, 2014 1:14 pm ] |
Post subject: | RE:Code working in Eclipse but not in Sublime Text |
String[] args not String args[] I believe |
Author: | chromium [ Thu Mar 13, 2014 3:03 pm ] |
Post subject: | Re: RE:Code working in Eclipse but not in Sublime Text |
Raknarg @ Thu Mar 13, 2014 1:14 pm wrote: String[] args not String args[] I believe
Made no difference. Same error. |
Author: | Zren [ Thu Mar 13, 2014 4:02 pm ] | ||
Post subject: | Re: Code working in Eclipse but not in Sublime Text | ||
Sublime Text doesn't have a full fledged console inside it. So you can't really use System.in to enter input. As a fix, you can change your build file to this:
The start command will open a new console window (Command Prompt), rather than tunneling the streams through Sublime. Ctrl+B = Build Ctrl+Shift+B = Run |
Author: | Raknarg [ Thu Mar 13, 2014 9:58 pm ] |
Post subject: | RE:Code working in Eclipse but not in Sublime Text |
Oh I didn't realize Sublime Text could compile code at all. |
Author: | chromium [ Thu Mar 13, 2014 11:21 pm ] | ||||
Post subject: | Re: Code working in Eclipse but not in Sublime Text | ||||
Zren @ Thu Mar 13, 2014 4:02 pm wrote: Sublime Text doesn't have a full fledged console inside it. So you can't really use System.in to enter input.
As a fix, you can change your build file to this:
The start command will open a new console window (Command Prompt), rather than tunneling the streams through Sublime. Ctrl+B = Build Ctrl+Shift+B = Run Great, that works almost perfectly. Command prompt opens and runs the program, however after everything has completed (get num, get den, return quotient as double), the console just closes. Is there a way to stop this from happening? So that the console stays open after all the code has executed? Edit: Nevermind, I figured it out. I needed to add a command to pause the console after completing:
|