Compiling Problem Java Project Exception
It's my java code that include nativfe methot.I compile it javac Bessel.java
And I wanted to jni.h file javah -jni Bessel but I had an exception
C:\Documents and Settings\TTG\Desktop>javac Bessel.java
C:\Documents and Settings\TTG\Desktop>javah -jni Bessel
error: cannot access Bessel
class file for Bessel not found
javadoc: error - Class Bessel not found.
Error: No classes were specified on the command line. Try -help.
***** What must I do *******
public class Bessel
// Declaration of the Native (C) function
private native double s17acc(double x);
static
// The runtime system executes a class's static
// initializer when it loads the class.
System.loadLibrary("nagCJavaInterface");
// The main program
public static void main(String[] args)
double x, y;
int i;
/* Check that we've been given an argument */
if (args.length != 1)
System.out.println("Usage: java Bessel x");
System.out.println(" Computes Y0 Bessel function of argument x");
System.exit(1);
// Create an object of class Bessel
Bessel bess = new Bessel();
/* Convert the command line argument to a double */
x = new Double(args[0]).doubleValue();
System.out.println();
System.out.println("Calls of NAG Y0 Bessel function routine s17acc");
for (i = 0; i < 10; i++)
/* Call method s17acc of object bess */
y = bess.s17acc(x);
System.out.println("Y0(" + x + ") is " + y);
/* Increase x and repeat */
x = x + 0.25;
}
C:\Documents and Settings\TTG\Desktop>javac Bessel.java
C:\Documents and Settings\TTG\Desktop>javah -jni Bessel
error: cannot access BesselMy guess would be that you set the env var CLASSPATH and that you did it wrong.
Similar Messages
-
How do I compile my Java project?
How do I compile my Java project? The "Build" option is missing from the right-click menu of my Project Explorer and I can't find a compile button.
On 08/05/2015 12:42 PM, Chris Wilkinson wrote:
> How do I compile my Java project? The "Build" option is missing from
> the right-click menu of my Project Explorer and I can't find a compile
> button.
Examine the Project menu. You'll see that, by default, Build
Automatically is checked. Each time you make a change to a Java file,
Eclipse rebuilds it into a .class file. To force the entire project to
be rebuilt, whether it needs it or not, select Project -> Clean.
Is this what you're looking for? -
10.1.3 - Compiler problem rebuilding projects
I found a problem compiling projects.
Until 10.1.2 when I compiled a project and I got some errors correct classes where compiled and stored, now only if all is correct compilation succeds and compiled classes are stored.
Is it possible to avoid that odd behaviour ?
Tks
TullioCannot confirm your observation.
I believe it really depends on the location of the error.
With 9.0.5.2 (!), depending on the location of the error, the amount of class files written differs enormously. Sometimes, it seems all class files are written except the ones with error. Sometimes almost no class files make it to the disk.
If that's the odd behaviour you're talking about then this already existed in 9.0.5.2.
Sascha -
Compiling a Java Project in Eclipse
Hey all, I'm having trouble compiling a project.
I had a Java class two years ago and I forget how to do it. I have all the files in a folder named "final" on my desktop.
Inside "final" is all my sounds, images, a file called table.class, sound.class, sound.java, and table.java.
How do I get this thing to be an executable again???Create a new project in Eclipse and get it to work like you want. Then go to File > Export to make a jar file.
-
Exception in thread "main" java.lang.Error: Unresolved compilation problem
The following code:
public boolean find(MusbachJ_Person person,BstNode node)
//p.l(person);p.l(node.intData);
if(node.intData.compareTo(person)==0)
return true;
if( node.leftNode != null ) find(person,node.leftNode );
if( node.rightNode != null ) find( person, node.rightNode);
else
return false;
}returns the following compilation error:
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
This method must return a result of type boolean
at MusbachJ_TreeNode.find(MusbachJ_TreeNode.java:32)
at MusbachJ_PeopleTree.main(MusbachJ_PeopleTree.java:91)
But I don't understand, the else statement is right there, what more does it want? Thanks! :)John_Musbach wrote:
Exception in thread "main" java.lang.Error: Unresolved compilation problem: Unresolved compilation problem is an error that you'll only ever see if you're using an IDE. If you used the javac compiler, then you would have seen that the code doesn't even compile.
The reason (as others have pointed out) is, that some paths through your method don't return a value.
I'll re-write your code in the code-style that I usually use, because then it might be easier for you to see the problem:
public boolean find(MusbachJ_Person person,BstNode node)
if(node.intData.compareTo(person)==0) {
return true;
if( node.leftNode != null ) {
find(person,node.leftNode );
if( node.rightNode != null ) {
find( person, node.rightNode);
else {
return false;
}There are two prolbems. I'll spell out the first and let the other one for you to find:
1.) you don't do anything with the return-values of the find-methods you are calling. What do you want to do with them?
2.) What do you return if the current node is not the one that you want and you've got a right node? -
Java.lang.Exception: Could not get name for DC project
Hello Experts,
We have a code which is downloaded from SVN repository.
I have imported the code from my desktop into NWDS and when I try to deploy it throws,
java.lang.Exception: Could not get name for DC project
I have referred few threads in SCN and solution suggested is to change the workspace and create a new DC & copy the _comp from old DC.
I tried the above solution but there are lot of build errors as we have few RFC models and it is throwing build errors for missing model reference.
Kindly help me on how to fix the error.
Thanks, SwarnaprakashDear Swarnaprakash,
The Web Dynpro DCs Import C:\----\user\.dtc\LocalDevelopment\DCs\sap.com\test and
the related package for DC is missing once check it after try to import.
Depending on which Java compiler preferences are set, you may see some
warnings in the "Task" view after importing the project. If the severity level for problems of type "Unused imports" (set in Preferences – Java – Compiler) has the value "Warning", the compiler will issue a warning for unused import references. Ignore these warnings!
Still You getting means delete your .metadata before take the backup.after open the NWDS again it will set new configurations in your system.
Thanks & Regards,
Durga Rao. -
Mapping Workbench Java Project Export Exception
Hello,
We're using TopLink Workbench 9.0.4.1 build 040128
We are experiencing exceptions when we try to export our Mapping Workbench Project as a java project file. (We have never had this problem before).
I fear we may have somehow corrupted the TopLink mapping project file(s) when we were last editing them. We can open the project file and all mappings and tables look clean. However, when we try to export the java project file we get an exception (see the stack trace below).
Is there any way to recover our project file? We had made a lot of changes before noticing the problem with the java project generation. It would be a lot of work to go back to our last good back-up copy and apply the updates all over again.
Here's the stack trace from the Workbench when trying to export the java project file:
java.lang.NullPointerException
at oracle.toplink.workbench.persistence.MWProjectToRuntimeProjectConverter.convertAggregatePathToFieldIntoTranslationDictionaries(MWProjectToRuntimeProjectConverter.java:189)
at oracle.toplink.workbench.persistence.MWProjectToRuntimeProjectConverter.convertMappings(MWProjectToRuntimeProjectConverter.java:715)
at oracle.toplink.workbench.persistence.MWProjectToRuntimeProjectConverter.convert(MWProjectToRuntimeProjectConverter.java:74)
at oracle.toplink.workbench.model.MWProject.exportJavaSource(MWProject.java:885)
at oracle.toplink.workbench.model.MWProject.exportJavaSource(MWProject.java:848)
at oracle.toplink.workbench.ui.ProjectSourceGenerationCoordinator.exportProjectSource(ProjectSourceGenerationCoordinator.java:162)
at oracle.toplink.workbench.ui.MainView.exportSelectedProjectsToJavaSource(MainView.java:616)
at oracle.toplink.workbench.ui.ActionManager$50.actionPerformed(ActionManager.java:1395)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(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.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(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)Are there many aggregate mappings in your project? Or do you know of any aggregate mappings or mappings in aggregate descriptors that have changed since you last exported your java source successfully. It appears that something in an aggregate mapping has become corrupted and I'm just wondering if you can narrow down where the problem might have occured. If this is possible, then try remapping those aggregate mappings and then generating the java source again.
If it is not possible or this does not solve the problem, you will need to send this project and the class files in to support.
Thanks,
Karen Moore -
Java compiling problem, very important ??
Hi,
When I will compile my java code (see source) I get the following message
java.lang.NullPointerException
at table1.main(table1.java:95)
The problem is in line 95 : values[k] = (String)vals.nextElement();
What have I done wrong ?????
When any one has a solution, thanks in advance
regards, mkasel
source:
import java.util.Hashtable;
import java.util.Enumeration;
import javax.naming.*;
import javax.naming.directory.*;
public class table1 {
public static String MY_SEARCHBASE = "l=ASA";
public static String MY_FILTER = "cn=*";
// Specify which attributes we are looking for
public String MY_ATTRS[] = {"sn", "telephoneNumber","givenName"};
Enumeration vals;
Hashtable list= new Hashtable();
public static void main (String args[]){
try {
// Binding
// Hashtable for environmental information
Hashtable env = new Hashtable();
// Specify which class to use for our JNDI Provider
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
// Specify the host and port to use for directory service
env.put(Context.PROVIDER_URL, "ldap://scd2ldap.mens.net:389/ou=ICN,o=MENS,c=FR ");
DirContext ctx = new InitialDirContext(env);
// Begin search
// Specify the scope of the search
SearchControls constraints = new SearchControls();
constraints.setSearchScope(SearchControls.SUBTREE_SCOPE);
// Perform the actual search
// We give it a searchbase, a filter and the constraints
// containing the scope of the search
NamingEnumeration results =ctx.search(MY_SEARCHBASE, MY_FILTER, constraints);
// Now step through the search results
while ( results != null && results.hasMore() ) {
SearchResult sr = (SearchResult) results.next();
String dn = sr.getName() + "," + MY_SEARCHBASE;
System.out.println (/*"Distinguished Name is " +dn*/);
// Code for displaying attribute list
Attributes ar = ctx.getAttributes(dn, MY_ATTRS);
// Has no attributes
if (ar == null) {
System.out.println(" Entry "+ dn );
System.out.println(" has none of the specified attributes\n");
} else {
// Has some attributes
// Determine the attributes in this record.
Hashtable elements=new Hashtable();
for (int i=0; i<MY_ATTRS.length; i++) {
Attribute attr = ar.get(MY_ATTRS<i>);
if (attr != null) {
vals=attr.getAll();
String[]values=null;
int k=0;
while(vals.hasMoreElements()) {
values[k] = (String)vals.nextElement();
k++;
elements.put(MY_ATTRS<i>,values);
list.put(dn,elements);
// End search
// end try
catch(Exception e) {
e.printStackTrace();
System.exit(1);
P.S. IMPORTANT <> means []Hi again,
I didn't understand you well, could you tell me what I
have to change in the code to solve the problem
Thanks,
mkasel
Well it is very simple
String[]values=null;
you have a pointer that can point to a string array but currently is pointing to null
values[k] = (String)vals.nextElement();
Now you try to access the String array but it doesn't point to an array of strings but to null that's why you get a java.lang.NullPointerException.
You first have to let the pointer point to an array for example by creating a new String array like:
values = new String[100];
in your case the best thing to do is get the amount of elements you have in your enumeration and use that instead of 100 -
Java.lang.Exception problem .. help needed
I have a class and i am trying to access a method of another class that is reading an object.
public void read(String filename) throws Exception {
String fn = filename;
ObjectInputStream out = null;
Object object = null;
try {
FileInputStream file = new FileInputStream(fn);
out = new ObjectInputStream(file);
object = out.readObject();
out.close();
} catch (java.io.IOException IOE) {
if (out != null)
try {
out.close();
} catch (Exception ex) {}
throw IOE;
When i am compiling the program it is giving me this error
unreported exception java.lang.Exception; must be caught or declared to be thrown
I'm quite new to java ... could you tell me how to catch this exception
its in this part
scoreTable.read("scores.txt");
ThanksTry this :
private void someMethod(){
try{
read("c:\\bank\\testobject.txt");
}catch(IOException ex){
ex.printStackTrace();
}catch(ClassNotFoundException ex){
ex.printStackTrace();
// you can use the object here
Object object;
public void read(final String filename) throws IOException, ClassNotFoundException{
ObjectInputStream out = null;
object = null;
try{
out = new ObjectInputStream(new FileInputStream(filename));
object = out.readObject();
}finally{
if( out != null ){
out.close();
} -
How to Compile java project on command prompt
Hello Friends,
I have created one java project in eclipse. It has 3 packages, 4 external jars and one Link source (meaning it uses other java package that is not in the same project folder)
It runs perfectly using eclipse.
Now I want to compile my project and want to run that project.
I tried using "javac -classpath........." but it didn't work for me. Here is the command I used:
I am running this command under my main project folder
javac -classpath ./../../../lib/tools/lib/blur/blur_formats-1.0.jar;./../lib/commons-codec/commons-codec-1.3.jar;./../lib/commons-httpclient/commons-httpclient-3.1.jar;./../lib/commons-logging/commons-logging-1.1.1.jar;./../lib/org.json/org.json.jar;./../lib/smack/3_0_4/smack.jar;./../../../device/branches/viper/Service/blur/common/push/src* ./src/com.proj.hnm.push.StartService.java*
1) /device/branches/viper/Service/blur/common/push/src - is a different package I am referring (not in my current project folder) - it has java files in com.pushsync package
2) ./src/com.proj.hnm.push.StartService.java is my main class, com.proj.hnm package also contains another 2 package, and those other packages also have .java files
Please tell me how do I run my java project?
ThanksHi
Since it works fine in Eclipse you should install the [Fat Jar eclipse plugin|http://fjep.sourceforge.net/] which will pack everything thats in your eclipse project into a single jar file. Then you can run: java -jar myProject.jar and it should work. -
Problem compilling a java file
I've got problems using my jdk1.2 .
When i try to compile a java file using ms-dos console or kawa program, appears this error text:
Javaw.exe has generated an error it's gonna be closed by windows , you must restart the program.
A error register is gonna be created.
UI have to tell tha this is a free translation that the text appears in spanish.
thanks a lotMaybe you should compile with javac.
-
Import java "java.lang.Exception" compile error
I have alreay imported "java.lang.Exception".
There are "Exception_" spec & body in program unit
--- problem is in this part
=================================================
WHEN ORA_JAVA.EXCEPTION_THROWN THEN
javaexc := ORA_JAVA.LAST_EXCEPTION;
Message('Java Exception: java/jarfile '||Exception_.toString(javaexc));
ORA_JAVA.CLEAR_EXCEPTION;
=================================================
I can't find toString() method in Exception_Hy,
Give to forum user other information.
Where does it happen?
Product? etc..
Regards -
Cannot compile Java files or create Java Project
Hi,
I cannot compile java files and also didn't see any option
for creating java project using flex 2 builder.
Actually am trying to create a FDS project with an option to
compile on the server. I am using Weblogic 8.1 SP5 as my server.
thank you
sunhi
this is may jvm.config file. Can anyone tell me if it is
right because all the fields are blank.
# VM configuration
# Where to find JVM, if {java.home}/jre exists then that JVM
is used
# if not then it must be the path to the JRE itself
# If no java.home is specified a VM is located by looking in
these places in this
# order:
# 1) JAVA_HOME environment variables (same rules as java.home
above)
# 2) bin directory for java.dll (windows) or
lib/<ARCH>/libjava.so (unix)
# 3) ../jre
# 4) registry (windows only)
java.home=C:\Adobe\Flex Builder 2.0 Beta 3\Flex SDK 2.0\jre
# Arguments to VM
java.args=-ea -Xmx384m
# Environment variables we care about, whitespace-separated
env=
# java.class.path - use this for adding individual jars or
# directories. When directories are included they will be
searched
# for jars and zips and they will be added to the classpath
(in
# addition to the directory itself), the jar to be used in
launching
# will be appended to this classpath
java.class.path=C:\Adobe\Flex Builder 2.0 Beta 3\Flex SDK
2.0\jre
# where to find shared libraries, again use commas to
separate entries
java.library.path=
thanks
sun -
RTPPlayerApplet.java compiling problem
Hi !
I'm newbie in JMF. I tried to compile RTPPlayerApplet.java
(http://java.sun.com/products/java-media/jmf/2.1.1/samples/samples/SimplePlayerApplet.java)
but cant find package rtp . I've installed JMF 2.1.1e everyfing works fine except that example ..........
Here's my errors :
RTPPlayerApplet.java:49: package rtp does not exist
import rtp.*;
^
RTPPlayerApplet.java:77: cannot resolve symbol
symbol : class ParticipantListWindow
location: class RTPPlayerApplet
ParticipantListWindow videogui = null;
^
RTPPlayerApplet.java:78: cannot resolve symbol
symbol : class ParticipantListWindow
location: class RTPPlayerApplet
ParticipantListWindow audiogui = null;
^
RTPPlayerApplet.java:182: cannot resolve symbol
symbol : class ParticipantListWindow
location: class RTPPlayerApplet
videogui = new ParticipantListWindow(videomgr);
^
RTPPlayerApplet.java:185: cannot resolve symbol
symbol : class ParticipantListWindow
location: class RTPPlayerApplet
audiogui = new ParticipantListWindow(audiomgr);
^
Note: RTPPlayerApplet.java uses or overrides a deprecated API.
Note: Recompile with -deprecation for details.
5 errors
Can some help me out?
Thanks.Solution:
delete all references of
ParticipantListWindow
and delete import *.rtp.
because rtp package is not existing in 2.1 ver -
Problem in compiling this java need help
package test;
public class simpleTest{
public simpleTest(){
int a =0;
import test.*;
public class testPackage{
public static void main(String [] args){
simpleTest sT=new simpleTest();
System.out.println("Package from Test A value = "+a);
}error got when compile this codes.
--------------------Configuration: <Default>--------------------
C:\Notes\testPackage.java:4: cannot access simpleTest
bad class file: C:\Notes\simpleTest.java
file does not contain class simpleTest
Please remove or make sure it appears in the correct subdirectory of the classpath.
simpleTest sT=new simpleTest();
^
1 error
Process completed.package test;
public class simpleTest{
private int a;
public simpleTest(int a){
// int a =0;
this.a = a;
public int getA() {
return a;
=============== 2 diff files===================
import test.*;
public class testPackage{
public static void main(String [] args){
simpleTest sT=new simpleTest();
System.out.println("Package from Test A value =
= "+st.getA());
}- Saishu can compile the java package?
Maybe you are looking for
-
JDBC connection to SQL Server 2000 Service Pack 4
Hello Everyone, I'm trying to do a simple application which save some values into a MS SQL Server 2000 Database's Table. The source code I've written is: package Logging; import com.brekeke.net.sip.sv.session.*; import com.brekeke.net.sip.sv.session.
-
J1IEX capture excise invoice error. part 2
was created to continue from this [thread|J1IEX capture excise invoice error.; which was locked for no apparent reason. Mr Jeyakanthan A, don't you lock my thread and telling me to search the forum for answer. i have done my search on this [ topic on
-
Comcast might possibly be the dumbest company I've ever dealt with.
After telling me for over a month that my address was serviceable and me purchasing a 130$ cable/modem (that I now can't return), I was told by Comcast that my house was unserviceable and that if I wanted to have their services I would have to pay 73
-
Hi support community i have an ISE deployment with two 3315 appliances running ISE 1.1.1.268 with patch 5 installed. im receiving many alarms as shown in the attached image. The alarmas are generated principaly during idle periods (for example in wee
-
AIR + TextArea + local Image
Hey everyone, I'm new in this Forum and hope that I'll find some help here. I have the following problem: In my AIR-Application there is a modified WYSIWYG-Editor to create HTML-Content. Everything works fine but I'm not able to display graphics in t