[HELP] When compiling and running, two consoles appear!
When I compile and run a program, 2 consoles show up.. This wasn't happening before. I'm confused.
After around 15 seconds, the lower window closes and the program starts.
Here's a picture:
http://i.imgur.com/iiqVvEr.png
Hi Narralol,
Sorry for late.
I have never reproduced this. Please try to clean & build a master application that runs and positions your test application.
I doubt that you may process start cmd window before you run this console app. Please try and to see if it exists.
Have a nice day!
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.
Similar Messages
-
How to compile and run java program at command console
hi there
can anyone tell me how to compile and run a java program at command console? I have installed JRE 1.3.1, and also have installed JBuilder 5 if it helps.try this
System.out.println("Enter your Name : ");
BufferedReader console = new BufferedReader( new InputStreamReader( System.in ) );
String s = console.readLine();
System.out.println("Hello : "+ s+" !" ); -
Help:Compiling and running Java Midlets?
Hello,
I am a fresh learner in Java.I am finding it very difficult to compile and run Java Midlets on the Computer system.Also,i will like to tranfer the Sourcecodes to a PDA i.e install it on the PDA and have the application walking well.Please help.Thank you.You will get all the detailed steps ( have a look at the ff link) to configure the sun wireless toolkit on a PC , midlet compiling, running , uploading to the Palm PDA and testing it on the device. As for the connection, you can use the hot synch cable or a bluetooth hot synch.
http://developers.sun.com/techtopics/mobility/midp/articles/palm
Cheers!,
Birhanu -
Compiling and running problems
Dear Friends:
I believe I encountered a very difficult situation when I try to run Fortran
files in Sun Sparc Solaris 8.0.
I would like to describe it, hopefully someone can give me some suggestions.
The the files I try to run is fortran 77 files developed originally for VAX
machine, later on there are Linux and Unix adaptions (but not for Sun
Solaris). The source code is open source from the link:
http://www.webmo.net/support/mopac_linux.html. I have compiled and run
successfully in Redhat 9.0 (means same results as the samples). The linux
dependency is gcc (or egcs) glibc (or libc) f2c.
Also it is compatible with SGI IRIX unix system with the dependency MIPSpro Fortran 77 and MIPSpro C as the link http://www.webmo.net/support/mopac_sgi.html. I havenot tried it yet.
In sun solaris, I have tried g77, but even cannot compiled. With Apogee's
F77 (www.apogee.com), it can be compiled, but cannot run completely (terminate in the middle
process, i.e. without the complete output as the samples).
Could anyone take a time do a analysis and provide me any suggestions?
thanks a lot,
JustinJustin,
I downloaded the mopac tarball and compiled it on Sun Solaris using the Sun Studio 10 compiler. The code compiles successfully with only a small change to the included Makefile.
Change the original unix target as follows:
unix:
f77 -w -O -static *.f -o $(EXE)
becomes
unix:
f90 -f77 -w -O *.f -o $(EXE)
I noticed during the compilation that there were a number of BLAS and LAPACK routines that are being compiled into the application. The Sun Studio compilers include a high performance BLAS/LAPACK library called the Sun Performance Library which provides highly tuned versions of the BLAS/LAPACK routines called by this application. I would be more than happy to help you modify the source and makefile so that you can use these tuned routines and realize increased performance in this application.
I ran several of the data sets in the examples directory and they appeared to complete successfully. Since none of them run for more than a second or so, it's hard to say whether or not the tuned Performance Library will have a large impact on the performance or not.
If you are interested, please contact me : [email protected] -
Java compile and run time questions
Hello, I have two generic question about java compile and run:
1. When I used javac to compile my project, it complained some classes can't be found. I added the jar file which contains these needed classes to the jre/lib/ext/ directory. The compiler no longer complains. But I'm confused. I thought the jar files in jre/lib/ext/ only used for java run time, not the compile time. Can someone help me to explain this?
2. If I need certain user defined jar file in the classpath to compile my application, does that imply that I have to have that jar file if I want to run my project?
Thanks in advance.1. lib/ext is used for generally finding classes, it doesn't matter whether you are compiling or running.
2. Yes, you will. -
How to Compile and run Smart Card Application
hi
any one can help me reagrding Javacard API. i download the JavaCard Development Kit from sun and install on my machine but i didn't get all java files and class files of JavaCard API. where i obtain those files so my application get compile and run.
pls help me i m new in this technology.
Thanks in Advance.My program Test.java in F:\Tomcat5\webapps\Ambika\WEB-INF\Classes. I compiled in the format below. I got like this. What should I do for this? But yesterday I compiled like this only, It compiled and the folder com\cert\Test.class is created. Today again I compiled the pgm after deleting the already created folder 'com\cert', I got the error like this.
I've given my pgm and the thing I've got when I compiled it.
Test.java
package com.cert;
public class Test
public void display()
System.out.println("Hai");
F:\Tomcat5\webapps\Ambika\WEB-INF\Classes>javac -d F:\Tomcat5\webapps\Ambika\WEB-INF\Classes\Test.java
javac: no source files
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are u
sed
-classpath <path> Specify where to find user class files
-cp <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-endorseddirs <dirs> Override location of endorsed standards path
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-version Version information
-help Print a synopsis of standard options
-X Print a synopsis of nonstandard options
-J<flag> Pass <flag> directly to the runtime system
F:\Tomcat5\webapps\Ambika\WEB-INF\Classes>
Plz help me.
thanks in advance
Ambika -
How to compile and run package programs in Java
Hi,
I want to know how to compile and run the package programs in Java using -d. instead of creating the package folder manually.
eg:
package Test;
class test1
public void disp()
//Any code;
I want to compile this without creating the folder ' Test ' manually. that is if we use -d with javac the Test folder will be created automatically. I need the format of -d
could anyone please help me.
Thanks in Advance ,
AmbikaMy program Test.java in F:\Tomcat5\webapps\Ambika\WEB-INF\Classes. I compiled in the format below. I got like this. What should I do for this? But yesterday I compiled like this only, It compiled and the folder com\cert\Test.class is created. Today again I compiled the pgm after deleting the already created folder 'com\cert', I got the error like this.
I've given my pgm and the thing I've got when I compiled it.
Test.java
package com.cert;
public class Test
public void display()
System.out.println("Hai");
F:\Tomcat5\webapps\Ambika\WEB-INF\Classes>javac -d F:\Tomcat5\webapps\Ambika\WEB-INF\Classes\Test.java
javac: no source files
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are u
sed
-classpath <path> Specify where to find user class files
-cp <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-endorseddirs <dirs> Override location of endorsed standards path
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-version Version information
-help Print a synopsis of standard options
-X Print a synopsis of nonstandard options
-J<flag> Pass <flag> directly to the runtime system
F:\Tomcat5\webapps\Ambika\WEB-INF\Classes>
Plz help me.
thanks in advance
Ambika -
Error in compiling and running a packaged application
Hi all,
I am new to java and studying alone java from sun's site.Now i am going through sun's step by step programming.From there i got a packaged Application named DiveLog which i wrote and saved in divelog directory in jdk1.2.2which is in C directory.
When i tried to compile it i got the error message as class Resource .java not found.But i have created the file Resource.java and saved in the same divelog directory.
somehow i get rid of the error and looked for the directory but class file is not there.So i understood that Compilation doesn't took place.
Can anyone help me to get rid of the error and compile and run the Application successfully.
Here is the DiveLog application i have written.
package divelog;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class DiveLog
private JTabbedPane tabbedPane;
private JFrame dlframe;
public DiveLog()
dlframe = new JFrame("A Java(TM) Technology Dive Log");
dlframe.addWindowListener(new WindowAdapter()
public void windowClosing(WindowEvent e)
System.exit(0)
tabbedPane = new JTabbedPane(SwingConstants.LEFT);
tabbedPane.setBackground(Color.blue);
tabbedPane.setForeground(Color.white);
populateTabbedPane();
buildMenu();
dlframe.getContentPane().add(tabbedPane);
dlframe.pack();
dlframe.setSize(765,690);
dlframe.setBackground(Color.white);
dlframe.setVisible(true);
private void populateTabbedPane()
tabbedPane.addTab("Welcome",
null,
new Welcome(),
"Welcome to the Dive Log");
tabbedPane.addTab("Diver Data",
null,
new Diver(),
"Click here to enter diver data");
tabbedPane.addTab("Log Dives",
null,
new Dives(),
"Click here to enter dives");
tabbedPane.addTab("Statistics",
null,
new Statistics(),
"Click here to calculate dive statistics");
tabbedPane.addTab("Favorite Web Site",
null,
new WebSite(),
"Click here to see a web site");
tabbedPane.addTab("Resources",
null,
new Resources(),
"Click here to see a list" + "of resources");
private void buildMenu()
JMenuBar mb = new JMenuBar();
JMenu menu = new JMenu("File");
JMenuItem item = new JMenuItem("Exit");
item.addActionListener(new ActionListener()
public void actionPerformed(ActionEvent e)
System.exit(0);
menu.add(item);
mb.add(menu);
dlframe.setJMenuBar(mb);
public static void main(String[] args)
DiveLog dl = new DiveLog();Classpath problem. Read the old threads related to in the classpath problem.
/Sreenivasa Kumar Majji.
Hi all,
I am new to java and studying alone java from sun's
site.Now i am going through sun's step by step
programming.From there i got a packaged Application
named DiveLog which i wrote and saved in divelog
directory in jdk1.2.2which is in C directory.
When i tried to compile it i got the error message as
class Resource .java not found.But i have created the
file Resource.java and saved in the same divelog
directory.
somehow i get rid of the error and looked for the
directory but class file is not there.So i understood
that Compilation doesn't took place.
Can anyone help me to get rid of the error and compile
and run the Application successfully.
Here is the DiveLog application i have written.
package divelog;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class DiveLog
private JTabbedPane tabbedPane;
private JFrame dlframe;
public DiveLog()
dlframe = new JFrame("A Java(TM) Technology Dive
Dive Log");
dlframe.addWindowListener(new WindowAdapter()
public void windowClosing(WindowEvent e)
System.exit(0)
tabbedPane = new
e = new JTabbedPane(SwingConstants.LEFT);
tabbedPane.setBackground(Color.blue);
tabbedPane.setForeground(Color.white);
populateTabbedPane();
buildMenu();
dlframe.getContentPane().add(tabbedPane);
dlframe.pack();
dlframe.setSize(765,690);
dlframe.setBackground(Color.white);
dlframe.setVisible(true);
private void populateTabbedPane()
tabbedPane.addTab("Welcome",
null,
new Welcome(),
"Welcome to the Dive
"Welcome to the Dive Log");
tabbedPane.addTab("Diver Data",
null,
new Diver(),
"Click here to enter
"Click here to enter diver data");
tabbedPane.addTab("Log Dives",
null,
new Dives(),
"Click here to enter
"Click here to enter dives");
tabbedPane.addTab("Statistics",
null,
new Statistics(),
"Click here to calculate
"Click here to calculate dive statistics");
tabbedPane.addTab("Favorite Web Site",
null,
new WebSite(),
"Click here to see a web
"Click here to see a web site");
tabbedPane.addTab("Resources",
null,
new Resources(),
"Click here to see a
"Click here to see a list" + "of
t" + "of resources");
private void buildMenu()
JMenuBar mb = new JMenuBar();
JMenu menu = new JMenu("File");
JMenuItem item = new JMenuItem("Exit");
item.addActionListener(new
istener(new ActionListener()
public void actionPerformed(ActionEvent
ed(ActionEvent e)
System.exit(0);
menu.add(item);
mb.add(menu);
dlframe.setJMenuBar(mb);
public static void main(String[]
d main(String[] args)
DiveLog dl = new DiveLog(); -
How to compile and run a java program?
I am getting this error message, what to do?
Exception in thread "main" java.lang.NoClassDefFoundError:
Thanks for you help.
AjayHello,
I believe that this error is caused because when you
compile and run a java program, you have to use the
same name that is next to public class. For example,
the program name is next to the word public class.
For example, if a program began like this:
public class Concat
then the name of the program in this case is Concat
and when you compile it you type: javac Concat.java
when you run it type: java Concat
depending on the name of your program.and depending on whether the class is in a package. And depending on what directory you are currently in.
Also depending on if you set your class path you might
have to type the above like this: jdk1.2.1\bin\javac
Concat.java to compile, and to run you would have to
type jdk1.2.1\bin\java Concat where you would replace
Concat with the name of your program and replace
jdk1.2.1 with the name of your version of java, that
is again if you do not have your classpath set. Hope
this helps.Your examples have nothing to do with whether the CLASSPATH is set--only with whether the PATH is set. And, it may not be jdkXXX\bin. The path to the JDK (in this case, to javac and java executables) could be anything. Classpath should be set on the command line. The OP probably did NOT set a classpath on the command line (preferred), or in the environment variables.
Also, make sure you did not forget to put:
public static void main(String[ ] args)
on the line underneath the line where it says "public
class Concat" where Concat is the name of your
program. Again, I hope this helps.Irrelevant (with the info we have from the OP so far). The error says that the JVM can't even find the class--not that the class doesn't have a main. The "main" referred to in the error message is within the JVM itself.
OP: Did you fix your problem? If not, what directory are your files in? Are they in a package? What command are you typing to get that error? That is, please tell us your entire command line. -
How should I compile and run my jdbc application ?
I need help about how is the correct way for compile and run my application conecta.java using a driver postgresql-8.3-603.jdbc3.jar for connect to my database under Postgresql 8.1.4, . I have compiled as follow :
javac -cp postgresql-8.3-603.jdbc3.jar conecta.java
and I have compiled with sucessful obtaining conecta.class
but when I try using :
java conecta
a message display an error :
java.lang.ClassNotFoundException: org.postgresql.Driver
I didn find the cause , I try modifing the classpath onto .bash_profile :
# User specific environment and startup programs
JDK_HOME=/usr/local/jdk1.5.0_01
JAVA_HOME=/usr/local/jdk1.5.0_01
PATH=$JAVA_HOME/bin:/usr/lib/pgsql/bin:$HOME/bin:$PATH:.
CLASSPATH=$JAVA_HOME/lib/postgresql-8.3-603.jdbc.jar:$CLASSPATH.
export PATH CLASSPATH JAVA_HOME JDK_HOME
unset USERNAME
but the message is the same . I have downloaded the driver into the same directory where is sited concecta.class and conecta.java . I don't understand why netbeans works fine runnning my application. I will be glad if anybody help to me.
ThanksMiguel231152 wrote:
I need help about how is the correct way for compile and run my application conecta.java using a driver postgresql-8.3-603.jdbc3.jar for connect to my database under Postgresql 8.1.4, . I have compiled as follow :
javac -cp postgresql-8.3-603.jdbc3.jar conecta.javaActually, you probably don't need the JAR in the CLASSPATH to compile. You shouldn't refer to PostgreSQL classes in your code, just java.sql interfaces.
and I have compiled with sucessful obtaining conecta.class
but when I try using :
java conectaGotta have the JAR in the CLASSPATH at runtime. That's why you get that exception, and that's always what it means.
a message display an error :
java.lang.ClassNotFoundException: org.postgresql.Driver
I didn find the cause , I try modifing the classpath onto .bash_profile :
# User specific environment and startup programs
JDK_HOME=/usr/local/jdk1.5.0_01
JAVA_HOME=/usr/local/jdk1.5.0_01
PATH=$JAVA_HOME/bin:/usr/lib/pgsql/bin:$HOME/bin:$PATH:.
CLASSPATH=$JAVA_HOME/lib/postgresql-8.3-603.jdbc.jar:$CLASSPATH.Useless. Java ignores CLASSPATH environment variable.
export PATH CLASSPATH JAVA_HOME JDK_HOME
unset USERNAME
but the message is the same . I have downloaded the driver into the same directory where is sited concecta.class and conecta.java . I don't understand why netbeans works fine runnning my application. I will be glad if anybody help to me.
ThanksUse the -classpath option at runtime. That'll fix it.
% -
Problems compiling and running a servlet
I have been trying to compile and run my servlet program to no avail. Please help. I am using Tomcat 5.5 and j2sdk1.4.2
These are the errors I keep getting. I have already set the classpath appropriately.
MyServletTest.java:5: package javax.servlet does not exist
import javax.servlet.*;
^
MyServletTest.java:6: package javax.servlet.http does not exist
import javax.servlet.http.*;
^
MyServletTest.java:10: cannot resolve symbol
symbol : class HttpServlet
location: class MyServletTest
public class MyServletTest extends HttpServlet {
^
MyServletTest.java:13: cannot resolve symbol
symbol : class HttpServletRquest
location: class MyServletTest
public void doGet (HttpServletRquest req, HttpServletResponse resp)
^
MyServletTest.java:13: cannot resolve symbol
symbol : class HttpServletResponse
location: class MyServletTest
public void doGet (HttpServletRquest req, HttpServletResponse resp)
^
MyServletTest.java:48: cannot resolve symbol
symbol : class HttpServletResponse
location: class MyServletTest
private void printResultSet (HttpServletResponse resp, ResultSet rs)
throws SQLException {
^
MyServletTest.java:52: cannot resolve symbol
symbol : method prinln (java.lang.String)
location: class java.io.PrintWriter
out.prinln("<html>");
^
7 errorsThank you. I have managed to compile the program but
when I run it I get:
Exception in thread "main"
java.lang.NoSuchMethodError: main
How should I run a servlet?Servlets are not run like applications. You need to deploy them to a servlet container, and they get invoked and initialized by constructor, init() method and goGet/doPost(). -
Issues installing and running two pieces of software
I have tried to install and run two pieces of software so far without luck. Skype and Gimp, both appear to need X11 running which I believe I have done. When either of the dmg files are run either nothing happens or just the X11 command window pops up.
I'm running a MacBook Pro with OS 10.7.4 13.5 inch
So what do I need to do to be able to run software on a Mac?Can you explain why every time I try to install Skype it launches X11 and then does nothing else?
-
How can I compile and run other java classes from within an application?
Hello there everyone! I really hope that someone can help me. I am writing a program that must be able to compile and run other java classes that are in different files, much like development environments like Kawa or Forte allow you to do.
There has to be a way of doing this ( I hope!! ), but i can't seem to find it!!
I have tried using this command to compile:
Runtime.getRuntime().exec ("c:\\programs\\javac className.java");
...and this one to run:
Runtime.getRuntime().exec ("c:\\programs\\java className");
...but neither works!!! I can compile and run classes that are in the same file as my application, but I can't get it to work at all for files in different directories or files.
PLEASE, PLEASE, PLEASE help me - i've run out of ideas, and i need this to be working in 3 days!!!
Thank you very much for any help anyone can give me, I really appreciate it!! Thanks again!!
Adrian ( ...in distress!! )public class JavaCompiler{
public static void main(String[] args)throws Exception{ //sorry bout the laziness
if(args == null || args.length != 1){
System.out.println("Usage: java JavaCompiler MyClass.java");
System.exit(0);
String className = args[0];
Runtime rt = Runtime.getRuntime();
Process p = rt.exec("javac " + className); //consider setting cpath for this
p.waitFor();
//now try to run after it is done.
p = rt.exec("java " + className.substring(0, (className.length() - ".java".length()));
p.waitFor();
//do some other stuff
}This should get you going. You may consider looking into the System.getProperty() method in order to determine the type of OS it is running on in order to findo out what command to run. I know that the sun tool listed above is nice, but by my understanding the sun tools provided are not guaranteed to stay the same. I'm no expert on this matter, but that is one of the reasons there is no API documentation for those tools. Also, I don't believe those tools come packaged with the JRE. (Of course if you are making an IDE it will be expected that the user has an sdk installed. Good luck with figuring this thing out. -
Compiling and running a package
Hi
Iduring making a project i am facing a problem. I have two files under the directory c:\jdk1.3\ghosh\das, named as ghosh.java and das.java
they are like the folloing:
ghosh.java
package.java.das;
import java.io.*;
import.java.util.*;
public class ghosh
public static void main(String args[])
das dipak = new das();
dipak.prn();
das.java
package ghosh.das;
import java.io.*;
import java.util.*;
public class das
das();
public void prn()
System.out.println("Package");
If you please tell me the way to compile and & run this package, I will be highly thankful to you.
thanx in andvance.
sudiptaThe statement "package.java.das;" won't compile. Do you mean "package java.das;" or do you mean "package ghosh.das;"? The -d option might not give you the result you want. If you mean, ""package java.das;" and you compile with "-d c:\jdk1.3" then the compiler will create a directory named java in the jdk1.3 directory and create a .class file inside the java directory.
Depending on the package statement, you execute the ghosh class with "java java.das.ghosh" or "java ghosh.das.ghosh" -
Compile and run java programs in different directroy
Hi,
I often encounter many problems when I run java programs in the different directories. Like
javac -d dir_name a.java
java -cp dir_name a
Something wired often happens, such as, there is not a.java file in some directory, but javac -d dir_name a.java can still work or "java -cp dir_name a" often doesn't work. Moreover, file_name.jar is also a tough problem and solving compiling problems is often time-consuming.
So I hope to read something about how to compile and run java programs in different directory properly.
Could you pleae give me a detailed description for that or recommend a book or website?
Thanks a lot.Can you post a small amount of code that does not work, including the directory structure, and the error messages? Some one here can likely explain the problem.
Maybe you are looking for
-
Slow imac with osx mavericks and other problems
I have a late 2012 imac, after uprgrading to mavericks it is jerky, laggy, not very smooth, my internet is up and down, and many things in system preferences are not working even tough im an administrator. For example i want to reeboot from macintosh
-
Hello!! I have some questions regarding VC and WAD integration, I have read that if I am using BW 3.x I have to add code in WAD, but I dont know anything regarding BW 7, Is it needed code (programming)??? or how can I integrate WAD objects in VC? wit
-
Updated IE and now Adobe Reader X & XI jumble words
I have been using IE 8 and just updated to IE 11 (I also tried 9 & 10). I am currently using Adobe Reader XI. When I go to save or print my documents they save or print jumbled; letters are left out spaces where they shouldn't be etc. I have searc
-
How Update Flash Player for Firefox Without Running Firefox?
I have had a problem with Firefox freezing when I try to do just about anything other than simple browsing for at least two years. Updates don't help nor disabling all add-ons, nor reinstalling, etc. Nobody can figure out how to fix it so I use it as
-
Compressor starts but refuses new jobs
Hi Compressor 3.0.1 worked fine up to recently. I think I broke off a job or something. Now when I start it or try to send from from FCpro, it appears in the menu bar with all menus but opens no window. These can be opened from "window" except when I