Sublime Forum

Sublime user input into console (using scanner class with java and running programs in sublime)

#1

Hi, ive set up sublime so that i can compile and run programs however, when i use the scanner class to allow user input i recieve an error. Is there anyway i can get user input to work with the sublime console?> im using ST2 im sure somehow its possible as notepad++ supports this (sublime is still better).

Thanks in advance

0 Likes

#2

###Edit:

I just posted a better solution @ Post 11

The Original Post is saved for reference.

1 Like

Run Python3 Code with input
Running Python on sublime console
#3

Ah so it launches the console ok cool ty! problem solved!

0 Likes

#4

going one step further is this possible with the portable version of sublime without accessing the c drive?

0 Likes

#5

I’m not completely sure, but I have a few ideas that might work. Post back if any of these work!

###[ 1 ]

If only a filename is given as an argument, "cmd" will check for that file @ PATH variable locations.

You should be able to change it to another drive by using an absolute path.

"cmd": ["D:\runJava.bat", "$file"]

###[ 2 ]

I’m not sure if Sublime Text includes any of its own directories in the PATH search. If it does, you could maybe try relocating the batch file there & leave the sublime-build code as is.

###[ 3 ]

Not sure if this is possible, but:

Include your Java\jdk1.7.0_79 files in the same location as your portable version of Sublime Text.

0 Likes

#6

[1] This also seems like it should work HOWEVER in APPDATA i can access all my packages in sublime which lets u alter the JavaC ect. but in the portable version of sublime this doesn’t exist - there are no packages in the portable version of sublime that can be altered there are only pristine packages which seem like they cannot be altered

[2]
No idea? where i would put the batch file - any ideas?

[3]
Maybe i will test this on Monday as the computer that im doing this on i wont have access to until then.

0 Likes

#7

Any luck getting this working?

0 Likes

#8

No
It doesn’t matter anymore. I have it working on normal sublime. Not on portable, that’s good enough (as I won’t be using portable version that much anymore)

0 Likes

#9

I do have another two questions
firstly is there a way so that if and only if the scanner class is imported then it launches the console otherwise it uses the original (runJava.bat).

And can it detect if there is already a console open and use that rather then everytime opening a new one?

ty

0 Likes

#10

Honestly I’m not too sure about either. I haven’t worked with build systems all that much, just enough to get them working.

 

Maybe look into:
##Build Systems
##Using Batch Files
##Batch Files & Batch Commands
##Using Windows PowerShell

0 Likes

#11

I just created a new script which is a lot more customizable than the one I originally posted.

###Check it out @:
##[TEMPLATE] Powershell Script for Multi-Command Builds with Input

0 Likes