How to import class in JAVA ?????
from the website
http://java.sun.com/j2se/1.4/compatibility.html
SAYS :
To summarize, the syntax
import SimpleName;
is no longer legal.
which would import a nested class from the unnamed namespace. To fix such problems in your code, move all of the classes from the unnamed namespace into a named namespace.
But i don't know what is the meaning of move all of the classes from the unnamed namespace into a named namespace.
Would anyone give me a help ?
But i don't know what is the meaning of move all of
the classes from the unnamed namespace into a named
namespace. You need to put the classes in a package: <http://java.sun.com/docs/books/tutorial/java/interpack/packages.html>
Basically creating a directory, placing all the classes in there, and adding a package statement at the start of the source files.
Bhav
Similar Messages
-
How to covert .class to .java
Hello All Programmers,
I have some .class files. I missed .java files, I want to convert .class to .java files.
Plz help me how to convert .class to .java file.
Thanks
Santoshbut do make sure you're legally allowed to decompile those classes.
If you are allowed to look at the source, most authors will provide you with it.
If not, you may be guilty of a crime if you do decompile, and at the very least are guilty of breach of contract with your supplier. -
Problems with importing classes in Java
Hello,
i have some problems with a simple project.
The structure is like this:
web-inf/classes/databeans/loginexistinguserform.java
web-inf/classes/formactions/loginexistinguseraction.java
loginexistinguserform.java :
package databeans;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionError;
import org.apache.struts.action.ActionMapping;
import javax.servlet.http.HttpServletRequest;
public class LoginExistingUserForm extends ActionForm
String userid;
String password;
public String getUserid(){return userid;}
public void setUserid(String newUserid){userid=newUserid;}
public String getPassword(){return password;}
public void setPassword(String newPassword) {password=newPassword;}
public ActionErrors validate(ActionMapping mapping, HttpServletRequest request){
ActionErrors errors=new ActionErrors();
if(this.userid==null||this.userid.equals(""))
errors.add("user",new ActionError("error.userid.required"));
if(this.password==null||this.password.equals(""))
errors.add("pass",new ActionError("error.password.required"));
return errors;
}loginexistinguseraction.java
package formactions;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import databeans.LoginExistingUserForm;
public class LoginExistingUserAction extends Action
public ActionForward perform(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException
LoginExistingUserForm loginData=(LoginExistingUserForm)form;
if(loginData.getUserid().equals("Admin")&&loginData.getPassword().equals("Parola"))
return mapping.findForward("successLogin");
else
return mapping.findForward("failureLogin");
}I can complie succesfully loginexisitinguserform.java but problems appears when i want to compile the second file, loginexistinguseraction.java with command: javac loginexistinguseraction.java
C:\ApacheGroup\Tomcat\webapps\PersonalWeb\WEB-INF\classes\formactions>javac loginexistinguseraction.java
loginexistinguseraction.java:10: package databeans does not exist
import databeans.LoginExistingUserForm;
^
loginexistinguseraction.java:17: cannot find symbol
symbol : class LoginExistingUserForm
location: class formactions.LoginExistingUserAction
LoginExistingUserForm loginData=(LoginExistingUserForm)form;
^
loginexistinguseraction.java:17: cannot find symbol
symbol : class LoginExistingUserForm
location: class formactions.LoginExistingUserAction
LoginExistingUserForm loginData=(LoginExistingUserForm)form;
^
3 errors
I have the CLASSPATH variable setup tu C:/Sun/Appserver/lib/j2ee.jar
Can someone help me ? Thank you in advance !Thank you very much ! It worked. I'm really new in Jav a programming.
Now i have encoutered another problem. When i want to login, and enter user name and password i am redirected to a login.do page, instead of Welcome.jsp
Here is Login.jsp:
<%@taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@page contentType="text/html; charset=ISO-8859-1"%>
<html>
<head><title>Login Form</title></head>
<body>
<html:errors/>
<html:form action="/login">
<table border="0" width="200">
<tr>
<td>User Name:</td>
<td><html:text property="userid" maxlength="13"/></td>
</tr>
<tr>
<td>Password:</td>
<td><html:password property="password" maxlength="13"/></td>
</tr>
</table>
<br />
<html:submit value="Login"/>
</html:form>
</body>
</html>and here is struts-config.xml :
<?xml version="1.0" encoding="ISO-8859-1" ?>
<!DOCTYPE struts-config PUBLIC
"-//Apache Software Foundation//DTD Struts Configuration 1.2//EN"
"http://jakarta.apache.org/struts/dtds/struts-config_1_2.dtd">
<struts-config>
<!--========================beans for HTML form data=======================-->
<form-beans>
<form-bean name="loginBean" type="databeans.LoginExistingUserForm"/>
</form-beans>
<!--========================Action Mappings================================-->
<action-mappings>
<action path="/login" type="formactions.LoginExistingUserAction" name="loginBean" input="/Login.jsp" scope="session">
<forward name="succesLogin" path="/pages/Welcome.jsp" redirect="true"/>
<forward name="failureLogin" path="/pages/Diverse.jsp" redirect="true"/>
</action>
</action-mappings>
<message-resources parameter="MessageResources" />
</struts-config> -
Hi,
I have one colourfullfirework is a FLA file and Documnet is a AS file,
I want to import document class in FLA,
How can i do this??
Plz help me
Thanks,
JaxNain Documnet class follwoing this script
package
import flash.events.MouseEvent;
import flash.system.ApplicationDomain;
import flash.events.Event;
import flash.display.MovieClip;
import com.shinedraw.effects.ColorfulFireworks;
public class Document extends MovieClip{
private var _colorfulFireworks : ColorfulFireworks;
public function Document(){
this.addEventListener(Event.ADDED_TO_STAGE, on_added_to_stage);
private function on_added_to_stage(e : Event):void{
_colorfulFireworks = new ColorfulFireworks();
addChild(_colorfulFireworks);
var coverClass : Class = ApplicationDomain.currentDomain.getDefinition("Cover") as Class;
var cover : MovieClip = new coverClass();
addChild(cover);
cover.addEventListener(MouseEvent.MOUSE_OVER, on_cover_click);
private function on_cover_click(e:MouseEvent):void{
var cover:MovieClip = e.target as MovieClip;
removeChild(cover);
_colorfulFireworks.start();
when i import this Document in fla file then its not working,
and when i creat in Document class
package {
public class Document {
public function Document(){
trace("called");
then its trace as called.
so what can i do?
Thanks
JaxNa -
How to import classes in a package?
I am importing all the classes in a package like:
import packagename.*;
when i am trying to create an object of the class in that package it was showing error...
example.java:8: cannot access address
bad class file: .\address.java
file does not contain class address
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
address add = new address();
^
1 error
Below is my code....
import java.util.*;
import org.demo.*;
public class example
public static void main(String[] args)
address add = new address();
System.out.println("Address object created...");
}class name address.class
I am creating object as
address add = new address()
but it was showing the error -
How to import class files in Rhino shell
Hi,
i want to test some methods of ScriptEngineContext class in
Microsoft_Active-Directory-and-Windows_2011.1r3 collector, so i import
some class files in Rhino shell, but some errors apeared, detail steps
are following:
1. steve_zeng@suse01:~/sentinel/doc/Plug-ins/Collectors> cd
Microsoft_Active-Directory-and-Windows_2011.1r3, it will apear some
important jar packages(red fonts)
accountImpl.js commons-codec-1.3.jar dataobject.js
event.js joda-time-2.1.jar protoEvt.map sha1.lic
trust.js
account.js commons-io-2.4.jar date.js
eventsource.js js.jar Rec2Evt.map sqlquery.js
trusttype.js
agent.nfo commons-logging-1.1.jar docs
eventsourceserver.js LegacyEvtNames.map record.js sysEvents.map
utils.js
asset.js commons-logging-adapters-1.1.jar error_codes.map
Evt2EvtData.map logon_types.map release.js
syslog_facility.map vuln.js
bsf-240.jar commons-logging-api-1.1.jar EULAs
file.js main.js session.js taxonomy.map
window-field.map
collector.js connector.js
eventcode_parsing.js identityImpl.js master.jar
severity.map tenant.js xdas_out.map
collectorutil.jar data event_codes.map
identity.js package.xml sha1.js trustImpl.js
xdas_tax.map
2.
steve_zeng@suse01:~/sentinel/doc/Plug-ins/Collectors/Microsoft_Active-Directory-and-Windows_2011.1r3>
java -classpath ./js.jar org.mozilla.javascript.tools.shell.Main
Rhino 1.7 release 3 2011 05 09
js>
3. js> JavaPackage
esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext
js: "<stdin>", line 3: missing ; before statement
js: JavaPackage
esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext
js: .....................^
4. js> loadClass(JavaPackage
esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext);
js: "<stdin>", line 4: missing ) after argument list
js: loadClass(JavaPackage
esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext);
js: ...............................^
js>
when i run JavaPackage or loadClass shell, js: "<stdin>" error apears,
why? does anyone can help me? thanks!
BR
Steve zeng
steve_zeng
steve_zeng's Profile: https://forums.netiq.com/member.php?userid=3875
View this thread: https://forums.netiq.com/showthread.php?t=49805steve_zeng;239719 Wrote:
> Hi,
> i want to test some methods of ScriptEngineContext class in
> Microsoft_Active-Directory-and-Windows_2011.1r3 collector, so i import
> some class files in Rhino shell, but some errors apeared, detail steps
> are following:
>
> 1. steve_zeng@suse01:~/sentinel/doc/Plug-ins/Collectors> cd
> Microsoft_Active-Directory-and-Windows_2011.1r3, it will apear some
> important jar packages(red fonts)
>
> accountImpl.js commons-codec-1.3.jar dataobject.js
> event.js joda-time-2.1.jar protoEvt.map sha1.lic
> trust.js
> account.js commons-io-2.4.jar date.js
> eventsource.js js.jar Rec2Evt.map sqlquery.js
> trusttype.js
> agent.nfo commons-logging-1.1.jar docs
> eventsourceserver.js LegacyEvtNames.map record.js sysEvents.map
> utils.js
> asset.js commons-logging-adapters-1.1.jar error_codes.map
> Evt2EvtData.map logon_types.map release.js
> syslog_facility.map vuln.js
> bsf-240.jar commons-logging-api-1.1.jar EULAs
> file.js main.js session.js taxonomy.map
> window-field.map
> collector.js connector.js
> eventcode_parsing.js identityImpl.js master.jar
> severity.map tenant.js xdas_out.map
> collectorutil.jar data event_codes.map
> identity.js package.xml sha1.js trustImpl.js
> xdas_tax.map
>
>
> 2.
> steve_zeng@suse01:~/sentinel/doc/Plug-ins/Collectors/Microsoft_Active-Directory-and-Windows_2011.1r3>
> java -classpath ./js.jar org.mozilla.javascript.tools.shell.Main
> Rhino 1.7 release 3 2011 05 09
> js>
>
> 3. js> JavaPackage
> esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext
> js: "<stdin>", line 3: missing ; before statement
> js: JavaPackage
> esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext
> js: .....................^
>
> 4. js> loadClass(JavaPackage
> esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext);
> js: "<stdin>", line 4: missing ) after argument list
> js: loadClass(JavaPackage
> esecurity.ccs.comp.evtsrcmgt.collector.util.Script EngineContext);
> js: ...............................^
> js>
>
>
> when i run JavaPackage or loadClass shell, js: "<stdin>" error apears,
> why? does anyone can help me? thanks!
>
>
> BR
> Steve zeng
Can you explain a little more about what you're trying to accomplish by
this? The script engine is not really designed around facilitating
shell-based access right now,I'd be interested to know what you can't do
in the Debugger that you are trying to accomplish in the shell.
brandon.langley
brandon.langley's Profile: https://forums.netiq.com/member.php?userid=350
View this thread: https://forums.netiq.com/showthread.php?t=49805 -
How to import classes into labview project?
Hi everyone
I start objected oriented program with labview, I have two sample project and I want to import their classes into my new project? is it possible to do that ? how can I import them ?
thanksYou can simply add them like you would any other VI or library. I would recommend creating a virtual folder for your classes so you can keep your project organized.
Mark Yedinak
"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot -
How to instantiate class in java script
Hi, I'm new to java script. I have made a class in package project.attendance.model named CheckEmpId. I want to access methods of that class in my java script. Is it possible, if yes than how?
ThanksJavascript is client side, Java is server side. That fact alone makes it impossible for javascript to invoke your java code.
On the server side you have the ability to dynamically generate javascript however, so maybe you can fix your problem that way depending on what you want to achieve. -
How to import classes from an external actionscript file
This is driving me crazy, I've been trying to resolve this on my own for ages, and I've reviewed a lot of different materials, but I still can't seem to just import some external actionscript classes correctly.
I'm using Flash Builder 4 with the Flex 4 SDK on mac osx 10.6
the class I'm trying to import (I'll call it DesiredClass) is in a folder like this
/libraries/com/foreignproject/com/foreignproject/DesiredClass.as
within the class itself, the package declaration looks like this (I left all the guts out for clarity):
package com.foreignproject
import flash.display.Sprite;
public class DesiredClass extends Sprite
public function DesiredClass()
I'm working on a totally different actionscript file at
/Users/username/Documents/Adobe Flash Builder 4/TestProject/src/TestProject.as
in this file I try to import the DesiredClass:
package
import com.foreignproject.DesiredClass;
import flash.display.Sprite;
public class TestProject extends Sprite
public function TestProject()
var neatClass:DesiredClass = new DesiredClass();
And then I try to add the class I want to the source path.
I've tried adding each folder to the source path separately:
/libraries/com/foreignproject/com/foreignproject/DesiredClass.as
/libraries/com/foreignproject/com/foreignproject/DesiredClass.as
/libraries/com/foreignproject/com/foreignproject/DesiredClass.as
/libraries/com/foreignproject/com/foreignproject/DesiredClass.as
/libraries/com/foreignproject/com/foreignproject/DesiredClass.as
If I choose the libraries folder or either of the com folders then an error shows up in theTestProject.as file, saying:
Definition com.foreignproject:DesiredClass could not be found.
But f I choose either of the foreignproject folders then an error shows up in theDesiredClass.as file saying:
a file found in a source-path must have the same package structure 'com.foreignproject', as the definition's package, ".
What am I doing wrong? Please help. I bought a book on actionscript, started doing the flex-in-a-week series, read numerous online discussion boards, and I still can't import these classes.
Thanks in advance.I don't know if this method is supported anymore but you can give it a try.
If you backed up bookmarks in IE using the following directions, you should be good!
*In IE, "File -> Import and Export -> Export Cookies".
*Open newly exported "cookies.txt" in a text editor and put a period before every line that starts with a domain. So a line starting with <b>altavista.com TRUE / FALSE 1388491200 AV_ALL 1</b> will become <b>.altavista.com TRUE / FALSE 1388491200 AV_ALL 1</b>
*Then, move the "cookies.txt" file to your profile folder.
You can get to the Profile folder two ways
*Help > Troubleshooting Information > Profile Directory > Show Folder
or
*Go to '''about:support''' and click Show Folder next to Profile Directory. -
Hi,
how to import RFC in java?HI
Friend
Please find out the flowing link..
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/10c2c440-7f8c-2b10-7db0-dce34360f118
I thing it is very helpful to you..
used for Netweaver 7.0.09 java...and higher versions
Adaptive RFC model
Tanks
Rafi Shaik -
How to import custom java jar/class into oracle to be used in java proc ?
Hi
I would like to know how to import custom java jar/class files into oracle to be used in java stored procedure.
I am developing a oracle pl/sql procedure to call java program. The java program will be created as procedure and will be published.
But, my question is that I do have a other external jar/class file that need to be imported into this java program.
example
raise_sal.java
import java.util.*;
import oracle.sql.*;
<<reference other java programs >>
import cmpmsgsvc.xxxx.* ;
import cmpmsgsvc.yyyy.* ;
import cmpmsgsvc.zzzz.* ;
how do I import the cmpmsgsvc jar/class file into oracle so that I don't have any
compilation errros on raise_sal.java program ??
what are the steps to import/compile and validate to do this?
thanks for your help in advance.
Thanks
rrb.Kuassi
Problem is that, I have 6 jar files that are needed to be included in the main java program. And, there are more than 50+ classes, propertiers in those 6 jar files.
It might be not good idea to have all those 50+ classes in the production database.
Is there anyway that I keep all those 6 jar files in unix box (our's is oracle erp installation with oracle being installed on unix box) and just refer them in the main java program. I mean database will be loaded with main java program and it should able to refer other 6 jar files from unix.
if we create a directory and keep all jar files in there and include that directory in classpath variable, does this works? or what is other method?
Please let me know.
Thanks -
How to import java Classes in report Builder 10g
How to import java Classes in report Builder 10g .....
ArshadHello,
To import the Java classes:
Add your jar in the REPORTS_CLASSPATH
Launch Reports Builder.
Note:
You must launch Reports Builder now so that the new REPORTS_CLASSPATH is used.
Choose Program > Import Java Classes to display the Import Java Classes dialog box.
Regards -
How to import java Classes in report Builder
Hi, I want to import classes from a jar file into Report Builder (10 g). I'm not able to find my JAR in -- Program --> Import Java Classes option.
I have set the classpath pointing to my JAR.Hello,
To import the Java classes:
Add your jar in the REPORTS_CLASSPATH
Launch Reports Builder.
Note:
You must launch Reports Builder now so that the new REPORTS_CLASSPATH is used.
Choose Program > Import Java Classes to display the Import Java Classes dialog box.
Regards -
How to import a class not in the package from a package
how to import a class not in the package from a package?
http://java.sun.com/docs/books/tutorial/java/interpack/usepkgs.html
-
How to import user defined class in UIX page?
Does anyone know how to import user defined class in UIX page so that the class can be called in the javascript in the UIX ?
Thks & Rgds,
Bennywhat you are referring to is not javascript.
it is JSP scriptlets. These are very different.
In order to keep a strict separation between View and Controller, it is not possible to run arbitrary java code from within your UIX code.
However, you can run java code from within a UIX event handler; see:
http://otn.oracle.com/jdeveloper/help/topic?inOHW=true&linkHelp=false&file=jar%3Afile%3A/u01/app/oracle/product/IAS904/j2ee/OC4J_ohw/applications/jdeveloper904/jdeveloper/helpsets/jdeveloper/uixhelp.jar!/uixdevguide/introducingbaja.html
event handler code is run before the page is rendered.
Maybe you are looking for
-
Video requiring authorisation wont play
Since recent apple software updates (last few months) videos (in the correct mp4 format) no longer play inside my websites members area on Safari. The user is prompted for username and password when they initially login to the members area but when t
-
Quotation's pricing table please
Hi All, Could you please tell me in which table Quotations pricing is saved? Please tell me how to check the quotation's pricing in table level. Regards, Maddy
-
Hello, I have two objects. First object (1) has event listener MOUSE_OVER. On this object is another object (2) without listener. When I move with the mouse on second object, mouse over event on object 1 is not dispatched. I don't know why. How can I
-
I am having trouble getting it to work. Reports works fine and so does express. When I actually run the report I get message: RPC connectoin lost
-
Cannot play Pandora or YouTube using Safari
Since Tuesday I haven't been able to play Pandora or YouTube on my MacBook Pro, and use Safari for web browser. I'm running OS X 10.7.5. Today I updated my Flash Player and Pandora played for about 10 minutes, then nothing again. I reset Safari and