[Bluej-discuss] A weird bluej IDE. A bug?
Michael Kölling
M.Kolling at kent.ac.uk
Sat Apr 15 23:44:28 BST 2006
Hi Jason,
You are a bit unspecific about the error message you get -- when you
say "the system reports", what does that mean? Does it appear in the
BlueJ terminal? Or as an exception? In a dialogue? Or in your Windows
system somewhere?
Also, is the message text really accurate? It looks suspicious to me.
I clearly looks BlueJ related ("bluej.shell"), but BlueJ does not
create any file or process with this name.
When reporting error messages, please be specific and accurate, and
tell us the complete message.
So far, I can only guess. One guess is this: when you execute a
method in BlueJ, BlueJ creates a .java file, compiles it, executes
the class file, and after successful execution, removes it again.
Since you execute a command to compile all java files in the project
directory, and several processes are involved here (BlueJ's process,
the cmd.exe process that you start, the javac process started by that
one), I suspect there might be a possible order of evens that
produces this message. This might be:
- BlueJ creates it's java file for execution.
- the cmd.exe process gets created and runs, scanning the current
directory for *.java. This includes BlueJ's generated file, and
it's name
gets passed to the javac process
- BlueJ removes the java file
- the javac process runs, receives the file names, and reports that
the file (the one created and removed by BlueJ) cannot be found.
The files generated by BlueJ always have names in the format
__SHELLXX.java, where XX is a number.
This would not be a BlueJ bug, but just a side effect of intended
behaviour. But without more information, it's hard to tell.
Regards,
mik
On 15 Apr 2006, at 11:07, Jason Zong wrote:
> hi everyone.
>
> I am a fresh man here. Recently I program a small program, which I
> want to execute the specified string command in a separate process.
> Such as in a java program which could invoke java compiler to
> compile the specified java files.
>
> I put the class TestCmd in D:\Test directory, also there are some
> other java source files. I want the TestCmd to invoke the javac
> compiler to compile the specified java files which are stroed in c:
> \project\test2code. When I test my program, the weird thing
> happened. The process2 seems to find out a bug of bluej.
>
> Some time process2 failed in bluej. I commented the other three
> processes. It passes the compiling, if I run the program, it could
> fail sometime, and sometime it works well. When it failed, the
> system reports "bluej.shell doesn't exist ..." However the process2
> always works well under the command line environment.
>
> Please everyone try to run this program and think about? What cause
> that happened. Here the program is posted below.
>
> king regards
> Yours Jason Zong
>
>
>
>
> import java.io.*;
> import java.lang.*;
>
> //the TestCmd.java is stored in D:\Test directory.
> public class TestCmd {
>
> public static void main(String args[]){
> File dir=new File("C:\\Projects\\test2Code");
> String[] cmds={"cmd.exe /k start dir","cmd.exe /k start
> javac *.java"};
> for(int i=0;i<cmds.length;i++){
> System.out.println(cmds[i]);
> }
> try{
> //list the files in the current directory, where we
> store TestCmd.class D:\test, passed in both bluej and command line
> Process process1= Runtime.getRuntime().exec("cmd.exe /
> k start dir");
>
> //compile all the java files under the current
> directory, same as above. sometime failed in bluej but passed in
> command line
> Process process2= Runtime.getRuntime().exec("cmd.exe /
> k start javac *.java");
>
> //compile all the java files under the specified
> directory c:\..., passed in both bluej and command line;
> Process process3= Runtime.getRuntime().exec("cmd.exe /
> k start javac *.java",null,dir);
>
> //try to executes the specified commands and arguments
> in a separate process with specified working directory. failed in
> both.
> /*the exception information is weird, the systme output
> is "cmd.exe /k start dir" and "cmd.exe /k start javac *.java"
> * "java.io.IOException: CreateProcess: "cmd.exe \k
> start dir" "cmd.exe /k start javac *.java" error=2 ....."
> *
> * That is so strange.
> */
> Process process4= Runtime.getRuntime().exec
> (cmds,null,dir);
> }catch (IOException e)
> {
> e.printStackTrace();
> }
> }
> }
> _______________________________________________
> mailing list bluej-discuss at bluej.org
> To unsubscribe or change your preferences, go to
> http://lists.bluej.org/mailman/listinfo/bluej-discuss
More information about the bluej-discuss
mailing list