Program from Core Java book
I am running Java using the latest download version (1.4.1_02, I think?) from Sun on Windows XP Pro.
On page 25 of the book Core Java, there are instructions for running the Welcome program. The book says to first type "javac Welcome.java." This works fine because after doing this, I have a file Welcome.class. However, the next step is to type "java Welcome." When I do this, I get an error "Exception in thread "main" java.lang.NoClassFoundDefError: Welcome." The program Welcome comes with the CD that comes with the book, and I have only viewed it, I have not modified it in any way.
I have downloaded the JDK several times, and I still get this same error, so I do not think the problem is with downloading.
Thanks for the info. In line with this lame-ass Java
crap, when I type in "java classpath .Welcome" after
getting to the correct subdirectory, I get the message
"Exception in thread "main"
java.lang.NoClassDefFoundError: classpath." Looks
like I'm back to square one again! Nothing like a
total shit book with lame-ass fucking directions.You mis-read or mis-typed. It is
java -classpath . WelcomeThere is a space between each of these
java
-classpath
Welcome
Similar Messages
-
How to start an executable program from a java program ?
Hi,
does someone know how to start an executable program from a JAVA program ?
Thanks, Fred.Take a look at the Runtime class.
-S- -
How to move further from Core JAVA.
Hi,
I have studied Core JAVA upto multithreading.
And currently as S/w Quality Engineer, I am working on JUnit Tests in Spring Framework from last 2 months.
Now, I want to switch into development, and for the same I want to learn more in JAVA.
Please advice what more I need to learn to make myself proficient in JAVA so as that I can switch to development.
Thanks !I'm surprised by statement in the OP:
as S/w Quality Engineer, I am working on JUnit Tests in Spring FrameworkBut even more by this answer:
if you can push yourself to a professional level in the department of testing (creating and executing test plans, writing proper unit tests, doing test driven development, ...).I'm not disagreeing, just wondering: I have never met a professional "tester" that used jUnit. The testers I've met in organizations, even when they were were technical (usually graduated from programming to testing), had a mostly functional concern: check that a functionality works as expected. Creating and executing test plans, while an invaluable skill, is rarely matching the same job description as "writing unit tests".
Even integration testing, which requires development for injectors, simulators, etc... is not always (and I would say, rarely) amenable to using jUnit.
I seem to understand the OP means in-container automated tests. I understand how they can be referred to as integration tests (*not* unit-tests).
I have met (and been) developers who test their software, including at an integration or functional level, using jUnit or not, but they were "developers" who had acknowledged the importance of testing (conscientious developers, that is), not "testers" using jUnit as one of their tools.
One thing I can understand to justify a specific team writing in-container testing as those described, is an integration team integrating modules developed by several teams. Even then, I would call people in such a team developers, not testers.
Again I'm not disagreeing, just surprised: could you both comment on your experience as to how unit-testing can be a tester's concern as opposed to a developer's concern?
Are you working in organizations where full-time people in a QA team are devoted to write unit-tests or jUnit tests over code produced by other full-time people?
J.
Edited by: jduprez on Dec 10, 2010 7:03 PM
Yeah, "+invaluable+ skill", not unvaluable, thanks Andrew :o) -
As I am a beginer and I have a little bit knowledge of OOPs concepts, So any one suggest me a book which explains each concept of OOps with explanation and sufficent examples upto SWINGS and JDBC connections.
* Horstmann, C. S. and Cornell, G. (2004). Core
Java 2, Volume I� Fundamentals, 7th edition.
Upper Saddle River: Prentice Hall PTR.
* Horstmann, C. S. and Cornell, G. (2004). Core
Java 2, Volume II� Advanced Features, 7th
edition. Upper Saddle River: Prentice Hall PTR.Both great titles, they are sat next to me now.
If you are a true beginner then I'd also recommend:
Nino, J. & Hosch, F. A. (2001) An Introduction to Programming and Object Orientated Design Using Java John Wiley and Sons.
http://www.amazon.co.uk/exec/obidos/ASIN/0471354899/203-0474646-1863160
Although you'd probably be better with the more recent edition:
Nino, J. & Hosch, F. A. (2004) An Introduction to Programming and Object-Oriented Design Using Java: Java 5.0 Version. 2edn. John Wiley and Sons. http://www.amazon.co.uk/exec/obidos/ASIN/0471712272/ -
Compiling Java program from other java program
Hi,
How can I compile and capture the compilation result from another java program?
ThanksAs if I had seen somewhere a hint about being able to
programatically compile with the help of the class
sun/tools/javac/Main found in the tools.jar.I saw that article, too, but when I took a look at the JDK's source code, it became apparent that none of the classes in tools.jar are supported. Your program could break with any new version of the JDK.
If you're still interested, here's the URL:
http://java.sun.com/developer/JDCTechTips/2003/tt0722.html -
HT2584 How to delete programs from my mac book pro hard disk?
How to delete programs from mac book pro hard disk?
There is a better chance of getting help if you are specific.
Does dragging to the trash work? does it use an uninstaller? new to mac and unsure?
There are even 3rd party utilities to help remove programs. -
Please help with executing a java program from another java program
Hi, I have tried to execute a very simple java program which is printed out "Hello world" from another java gui program when the user click on the "START" button. However, I don't receive any print out on the terminal when they click it. These two programs are being developed in Unix environment. Here is the code that I am trying to use.
Runtime r = Runtime.getRuntime();
r.exec("java HelloWorld");
p.s. HelloWorld is java class of the HelloWorld.javaI think you have to luanch your MS Prompt first before executing the command.
-
Can't execute a DOS program from a Java one
Hi everyone !
I'm a student, working as an apprentice in a company, and I have to make a program to execute faster some daily routine.
Here's my problem : I'm trying to execute a DOS program (mkisofs.exe) whick takes numerous arguments and enables me to create an ISO file.
But, for now, I can't manage to make it work. I've used both Process and ProcessBuilder, but in vain (I'm a student, and not really a JavaProgrammingStar).
If I would manually execute the command, I'll have to type under DOS the following command :
"C:\Documents and Settings\myName\Desktop\Current\Local\mkisofs.exe" -r -J -l -L -b "isolinux/isolinux.bin" -c "isolinux/isolinux.cat" -no-emul-boot -boot-load-size 4 -boot-info -table -graft-points -o D:\ISO\toto.iso "C:\Documents and Settings\myName\Desktop\Current\Local\Clonezilla"or (without spaces)
C:\docume~1\myName\Desktop\Current\Local\mkisofs.exe -r -J -l -L -b "isolinux/isolinux.bin" -c "isolinux/isolinux.cat" -no-emul-boot -boot-load-size 4 -boot-info -table -graft-points -o D:\ISO\toto.iso C:\docume~1\myName\Desktop\Current\Local\ClonezillaTill now, I've only managed to execute windowed program such as MsPaint.exe or DOS program from System32 directory such as taskkill.exe, but I couldn't execute, for example, tasklist.exe, or at least, I couldn't see the result of this command.
Can anyone help me ?
If some code is needed, jsut tell me.
Thanks by advance !
HubertOk guys, I'm French, so excuse me if I didn't use the correct terminology, but I'm quite sure you understood that I was talking about MS-DOS command prompt in Windows XP.
Then, of course I've STFW, but none on my tries was successful. So a little help would be appreciated.
I've first tried this :
ProcessBuilder pb = new ProcessBuilder("cmd.exe", "/K", "mspaint.exe");
pb.redirectErrorStream(true);
try {
Process p = pb.start();
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
try {
String rep = in.readLine();
System.out.println(rep);
} finally {
in.close();
} catch (IOException e) {
e.printStackTrace();//repTF.setText("erreur");
}It worked.
But this :
String CMD = "C:\\docume~1\\myName\\Bureau\\Current\\Local\\mkisofs.exe";
String arg1 = "-r -J -l -L -b \"isolinux/isolinux.bin\" -c \"isolinux/isolinux.cat\" -no-emul-boot -boot-load-size 4";
String arg2 = "-boot-info -table -graft-points -o D:\\ISO\\toto.iso C:\\docume~1\\myName\\Bureau\\Current\\Local\\Clonezilla";
ProcessBuilder pb = new ProcessBuilder(CMD, arg1, arg2);
pb.redirectErrorStream(true);
try {
Process p = pb.start();
BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
try {
String rep = in.readLine();
System.out.println(rep);
} finally {
in.close();
} catch (IOException e) {
e.printStackTrace();//repTF.setText("erreur");
}does'nt.
What's wrong ? I should use a String table for args ? -
How to start a independant Daemon program from another java daemon?
Hello,
I made two java daemon program Daemon_A and Daemon_B. By definition these two program work whithout any user interaction but most of it they should never fall down.
So in order to be sure that the both daemon are up (and to prevent any failure) I create a mechanism to check each other and if one is down it will be restart by the other one.
Up to now I succeed to restart the one who fall down. But ... there is always a but ...
At start:
- 1) Daemon_A and Daemon_B start.
- 2) Daemon_B fall down.
- 3) Daemon_A restart Daemon_B using this:
String[] commandArray = new String[3];
commandArray[0] = "../bin/java";
commandArray[1] = "-jar";
commandArray[2] = "Daemon_B.jar";
Process oProcess = runtime.exec ( commandArray, (String[]) null);- 4) Daemon_A and Daemon_B are UP again.
- 5) Daemon_A crash then Daemon_B is kill too.
So once the Daemon_B is restarted it seems that there is still a link between Daemon_A and Daemon_B.
As I use a command system to restart the daemon I don't understand why my Daemon_B is dependant from the Daemon_A.
Is there another way of doing this?
How can I restart my Daemon_B (from the Daemon_A) in a independant process?
As i'm running out of idea any help will be apreciate,
thanks
EmmanuelBecause you do not need javaw on Unix. You can achieve
what you want in the normal Unix way. Confer: nohup,
&, stderr and stdout redircetion.That's not correct, I can not achieve what I want on Unix.
Well with the above piece of code if I use javaw for launching my command through a system command (runtime.exec) on windows it will start a 100% independant process which is find.
But under unix if I keep using simply java the process will stay a child process. Which mean if the "father daemon_A" die daemon_B will die too.
So that's why I woudering if there is a similar program as javaw on unix to avoid create chid process using 'runtime.exec'.
You mentioned crontab: it does not make an item to act
as a deamon, it rather periodically runs it. Yhea you right my mistake I don't use the crontab to launch the program. I use "etc/init.d" (for sun solaris) and service for windows. Otherwise the daemons are "real" daemon: one's they are started they keep listening and should never fall. But to get a hight level of security I want to be sure if one fall it will be restarted whithout beeing a child process of the other one.
so any idea on unix of how can I re-start a daemon in a independant way?
regards,
emmanuel -
To invoke a java Program from non-java Clients
I need to develop a program in java which will be invoked using some non java client. For example: for the time being my java application will be invoked by tandem. Also, a huge volume of transactions can be expected to come in and these need to be processed at high speed(response time of 5 seconds or so). Any suggestions ?
By Tandem..I mean a non-java client...
We need to look at possible architectures for implementing the payment module of the an application. We can think of the payment module as a Java process that does the following � 1. validate the card and some other stuff....
The payment module should be able to support non java clients...
Take the case when a customer swipes a card at a store.... Another process (call it the router) determines if the transaction info needs to be sent to my java program... If yes , the router invokes my payment module. The router can vary from store to store ... So my Payment module will be invoked by non java clients... As part of deciding on the architecture we need to decide on the protocol used for communication � http/tcp/iiop etc.
Also, we need to decide on the various options for implementing the payment module.... It can be webservices, EJB Session Beans etc... But the key point is ,.....performance.... A huge volume of transactions can be expected to come in and these need to be processed at high speed(response time of 5 seconds or so). -
class Turn
static public void main(String args[])
boolean t = true;
System.out.println("Before the return");
giri()
if(t)
return;
System.out.println("This won't execute");
When I am trying to Compile the above program geting this error. Any one ple
help me........
1.java:9: ';' expected
^
1 errorclass Turn {
public static void main(String argv[]) {
boolean t = true;
System.out.println("Before the return");
if(giri(t))
System.out.println("This won't execute");
private boolean giri(boolean t) {
return !t;
} -
Hi,
I want to revise all topics in Java, specially which are in the form of question/answers. i.e I don't want to revise as topics given in complete reference or any other book. I want the chapters which have question/answers in them.
Thanks...
R Swhy don't you just ask your teacher to give you an A without you doing any work because you're obviously brilliant and can't be bothered doing the work?
-
Compiling a program from a Java application
Hello,
I'm new to Java and i'm developing an application which takes in a Java source code (.java) and compiles (to create the '.class' file. However I dont know HOW i could use my Java program to compile the source code file.
I did a google search and found out that there is a com.sun.tools.javac.Main.Compile method to compile the source code. When i put this line into my code and i compile it, it says:
package com.sun.tools.javac.Main doesn't exist (assuming i need to have a package for it).
Does anyone know how I can resolve this? or know any good useful references I can read on the web?
note that i'm using Java 6.
Any help would be good. Thanks.Hi,
Note that your question was posted in the wong forum. It's not related to reflection.
What you tried to use is JDK version dependent, you should instead use the new Compiler API that's available if you are using Java 6.
[http://www.juixe.com/techknow/index.php/2006/12/13/java-se-6-compiler-api/]
Kaj -
Can i migrate my files and programs from one mac book to another
I have 2 macbook pros 13.3 april 2010 release
one has a 250gb drive and the other 500gb
both are running lion - after upgrading from snow leopard
I have al my adobe creative suite and mac office on the machine with 250gb hard drive - i want to transfer all my files and applications including adobe and mac office to the 500gb machine - can this be done via migration assistant? are there things i need to check etc before doing this
i am assuming the 250gb will be empty afterwards- i am not expecting to have 2 copies of the files and applications
Thanks for taking a look at my questionYou can do that through Migration Assistant without any problem. See > http://support.apple.com/kb/HT4889
There are different ways to connect both Macs in order to transfer the files. As both computers have got FireWire, I recommend you to buy a FireWire cable, connect it to both computers and run Migration Assistant. Doing this, the transfer will be faster and much reliable than with Ethernet or Wi-Fi. Also, check > http://pondini.org/OSX/MigrateLion.html -
Running ABAP program from web - java.lang.NullPointerException
Hi experts,
Need help. We have a web portal that one of the link is to call out a customized report to be displayed on nthe browser. There is a standard function to download the report by List -> Save/Send -> File. It seems that after we upgrade to ECC6/web dispatcher, this function failed to work. Our Basis has helped to check and they are highlighting that this is application side issue. They gave us the following:
Exception in thread "AWT-EventQueue-4" java.lang.NullPointerException: String is null
at sun.java2d.SunGraphics2D.drawString(Unknown Source)
at Query.paint(Unknown Source)
at sun.awt.RepaintArea.paintComponent(Unknown Source)
at sun.awt.RepaintArea.paint(Unknown Source)
at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.awt.EventQueue$2.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Frankly I really cannot understand this and also not sure how to solve it. Anyone have any ideas?Hi All,
I am also getting similar type of error
java.lang.NullPointerException
at se.abb.com.View2.wdDoInit(View2.java:102)
at se.abb.com.wdp.InternalView2.wdDoInit(InternalView2.java:202)
at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doInit(DelegatingView.java:61)
at com.sap.tc.webdynpro.progmodel.controller.Controller.initController(Controller.java:215)
at com.sap.tc.webdynpro.progmodel.view.View.initController(View.java:445)
... 34 more
Please help me to resolve this error.
Thanks
Uday
Maybe you are looking for
-
Converting DVD footage for use in FCP
I'm sure that this has been asked before, but I can't find it anywhere. Is it possible to take footage from a dvd and edit it in final cut? I have several old projects from my days in television on DVD that I need to use. How is this possible. Thanks
-
I bought a iPhone 6 yesterday and I restored my iPhone 6 from my iTunes back up. After my phone restored from back up. When I plug my iPhone 6 it's still saying my iPhone 6 is new and still giving me the restore from a back up or set as a new iPhone
-
Weird horizontal white lines going across the screen
I've had my nano 4g for around six months. When I first bought it, there was a single white line going across the top of the screen. It never really got in the way, so I didn't bother exchanging the ipod. Recently, another white line of pixels appear
-
Are there permissions required to delete table_names in user_tables
i have written a stored procedure in it there is a line "Delete from User_tables where TABLE_NAME like v_TableName;" this query deletes contents in TABLE_NAME column of USER_TABLES in DATABASE but when i executed it it is showing ERROR ": ORA-0103
-
Error when message mapping refers to old SWCV
When you open a message mapping that has a message type from an old SWCV, e.g. FSAPPL 200, but this Enterprise Service Repository only has a newer version of the SWCV, e.g. FSAPPL 400, you get an error and you cannot display the mapping. Is there a w