473,440 Members | 1,806 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,440 software developers and data experts.

problem with the path with Class.forname() method

mickey0
142 100+
Hello,
I wrote this and it doens't find the proper path:
Expand|Select|Wrap|Line Numbers
  1. String userDir = System.getProperty("user.dir");
  2. Class c = Class.forName(userDir + "\\" + "Page");
  3. either:
  4. Class c = Class.forName("Page");
  5.  
Page.class is located in the same dir returned by "System.getProperty("user.dir");"
The tree of directory is:
Expand|Select|Wrap|Line Numbers
  1. Myproject\Page.class
  2. Myproject\bin\.....
  3. Myproject\src\.....
  4. etc. etc.
  5.  
I tried (using "Class c = Class.forName("Page");" ) to move Page.class in the \bin directory using of my project and it works! So I guess is a path problem!
But what's the problem?
thanks
Jul 21 '10 #1
0 1477

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Phoneix | last post by:
Hello , I have a necessity to delete a jar file which is in the CLASSPATH. But JVM locks it after a class.forName() call, even though the class loaded is NOT in the JAR file I want to delete. ( I...
16
by: Manuel | last post by:
hi, In the past I made the question "how to implement a simple class forname". I made this finally and it compiled well. but now when i execute the program, it crash with a sigsegv. The code...
2
by: jean-francois | last post by:
In java you can do it with Class.forName("myClass").newInstance(); this will return you a new instance of the class myClass, provided that you defined it elsewhere. How can I get this in c++...
1
dmjpro
by: dmjpro | last post by:
can't i load a class with call the particular constructor using class.foename as we do class_name class_var = new class_name(some_values) plz help me thanks in advanced
4
by: shed | last post by:
Hi, is there something in javascript like Class.forName in Java? I have the name of my Objectname as String so I can't use the keyword new! Thanks, shed
7
by: Debabrata Jana | last post by:
Dear Friend Please explain the topic--- which one is better to use class.forName or DriverManager.registerDriver at the time when we want to get a connection with database. Please explain it.. ...
1
by: Sergei Riaguzov | last post by:
Is there a way to create an instance of a class SomeClass in PHP having a string "SomeClass"? The idea is to create instances on classes based on dynamic information obtained from $_POST. Like ...
1
by: Max S | last post by:
I have a very large program that loops through about a thousand class strings and does Class.forName(...) on them. It is taking about 100+ milliseconds to execute forName(...) on the classes that...
1
bsadhukhan
by: bsadhukhan | last post by:
When we connect database, we first load driver with code like Class.forName(driverName);. Now forName() has a return of type Class or Object. But we dont keep that return type, we sure that it is in...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.