PDA

Click to See Complete Forum and Search --> : EZ question! :)


invitro
Dec 3rd, 2000, 08:49 PM
Ok in J++ how do i write to a file?
Just normal string or binary.
and how do i call an Exit Sub or Exit Void
?

cause i have a switch that becomes false when u click it, and becomes true if u click it again

so i have
if 1 = 1 then 1 = 2
if 1 = 2 then 1 = 1

so when the first one executes, the second one executes right after it so it dosent do anything, help! :)

Dec 3rd, 2000, 09:06 PM
See
http://java.sun.com/docs/books/tutorial/essential/io/filestreams.html
and
http://forums.vb-world.net/showthread.php?threadid=42784

invitro
Dec 3rd, 2000, 10:09 PM
Awsome thanks!
And what about running files.. like the shell command in VB

Sorry im a newbie, but i actually learn better this way then trough books!

Anyways, i also had the question about the resource manager. I know i use to be able to insert Bitmaps and JPG's in my project trough the resource manager or soething like that, but i cant happen to find it now. Any ideas what im talking about or am i thikning about something elsE?

[Edited by invitro on 12-04-2000 at 12:38 AM]

Dec 4th, 2000, 10:20 AM
Check the "exec" method. It can take several forms, but I typically use this one where "command" is a String.

java.lang.Runtime.getRuntime().exec(command);

Also, you may need to return a Process to get output depending on the app you launch. exec runs in a new process space (memory etc), so don't think it's related to a console and System.out.

java.lang.Process p = java.lang.Runtime.getRuntime().exec(command);

Then you can capture it's output with getOutputStream() etc.


I've moved away from IDE's in Java. I prefer notepad and a dos prompt. Inserting resources sounds like an IDE function. You did say that you use J++; try its "Help".

invitro
Dec 5th, 2000, 07:11 PM
Ok so how come when I do

Runtime ShellExec = new Runtime();

and then i do
ShellExec.exec("PROGRAM");

its going to as for an IOException or something.
So i do


try {
ShellExec.exec("PROGRAM");
}catch{IOException EX){};

and that works, except it sais it cant find Runtime in the class. But why do i have to use try in teh first place, and why dosent it find runtime. When i do

java.lang.Runtime.getRuntime().exec("PROGRAM");
it works fine!

aND also, how can u execute a file u added to your program. Like i have a .jpg file in my files, where classes are and stuff, i just dont know how ican extract it and use it.

My friend has my MSCD library disk cause his got scratched and it dosent read right.

Anyways, thanks for the replies!


[Edited by invitro on 12-05-2000 at 08:41 PM]