Wrox Programmer Forums
|
BOOK: Beginning Java 2
This is the forum to discuss the Wrox book Beginning Java 2, SDK 1.4 Edition by Ivor Horton; ISBN: 9780764543654
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Java 2 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 19th, 2005, 05:11 PM
Registered User
 
Join Date: Aug 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default It compiled, but- - -

hello,

  i have the ByteTest.java file located on my harddrive at
C:\javasrc\wrox\ByteTest.java . i compiled the program and i received a class file at this same location. but when i run
the command java javasrc\wrox\ByteTest i get the error message:

Exception in thread "main" java.lang.NoClassDefFoundError: wrox\ByteTest (wrong
name: ByteTest)
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknow n Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.access$100(Unknown Source)
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)

i have tried other java programs at this same location and they run fine. i hava also tried putting in -cp -ea but i am a little unfamiliar with these. it looked like
java -cp -ea . javasrc\wrox\ByteTest
also tried
java -cp -ea . javasrc.wrox.ByteTest

just can not get this to work

thanks for the help
craig



 
Old August 19th, 2005, 07:38 PM
Registered User
 
Join Date: Aug 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

i found the answer
1) i needed to declare a package in the first line:
package wrox;

2) also when i compile this code i can use either the dot(.) or this
slash(/) but this one does not work (\). so it would like

c:\javasrc>java wrox.ByteTest

         or

c:\javasrc>java wrox/ByteTest










Similar Threads
Thread Thread Starter Forum Replies Last Post
error(compiled by vc6.0) in the sample ? tostar BOOK: Professional C++ 1 August 23rd, 2008 02:55 AM
compiled phuc2583 ASP.NET 2.0 Professional 1 March 24th, 2008 11:10 PM
compiled xslt e-bell XSLT 1 April 13th, 2007 01:01 PM
Global Resources Compiled? hpox ASP.NET 2.0 Basics 1 March 16th, 2007 12:58 PM
Compiled HTML Issue pvasudevan HTML Code Clinic 9 August 16th, 2006 07:29 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.