Import CLASS with no package name in VAJ
IMport statement in VAJ for .class (no source and No package specified in the class) goes always to the "default package". Is there any way how to:
1. change package in existing class wihout source
2. do the "package naming" when the class is imported ?
3. refer this "default package" by import statement ?(it has no valid name , of course)
I have tried whatever, but ...? I know, this question was already here in forum at 2001, but, nobody responded ... tks //petr
There is no way of doing it to the class file. Class files cannot be compiled and therefore cannot be changed.
You could download a decompiler which gives decompiles the class into a .java file. Then edit that java file to move the class.
Will
Similar Messages
-
Reflection Classes with the same name
Hi!
I have a big problem with reflection. I want to reflect lots of stuff (methods, variables...) in a lot of classes with the same name immediately one after the other. It's like
copy the file for the analysis to the right place
do reflection and get results
copy next file for analysis
Important to note is, that all of the files that should be reflected have the same name.
When I run the programm, he always only reflects the first file I gave for analysis, although I know the copying-stuff works and the new file would be there for analysis (but he does not seem to load/use it).
Any ideas what i could do?
Thanks!
ETI'm not sure if i'm authorised to tell too much
details, but i have to do some automated software
analysis and therefore I need to know whats inside of
a class and string search would not be appropriate.Why not ? What aspects of the class are you trying to examine ?
They have the same name, because they are delivered in
that form from a third party and it would be too much
effort (and to much risk of errors) to rename them.Sure, if they're delivered as class files, you're unable to rename them. Without knowing more I can't advise you further.
Why are you interested that much in that topic? Do you
have to perform a similar task?No, I'm trying to determine if reflection is the right tool for the job. Frankly it doesn't sound like it is. But since you're not authorised to tell me more, I can't help you more.
Dave. -
Revision: 13083
Revision: 13083
Author: [email protected]
Date: 2009-12-17 16:10:05 -0800 (Thu, 17 Dec 2009)
Log Message:
Updated MASTAdapter class with new trait names and events.
Modified Paths:
osmf/trunk/plugins/MASTPlugin/org/osmf/mast/adapter/MASTAdapter.as
osmf/trunk/plugins/MASTPluginIntegrationTest/src/org/osmf/test/mast/TestMASTPluginInfo.as
osmf/trunk/plugins/MASTPluginIntegrationTest/src/org/osmf/test/mast/adapter/TestMASTAdapt er.asSilviu!
I'm really sorry, but as all the office is trying to fix the problem, someone replaced the url content with the stuff that was pointing to the local machine.
I've fix it, and the video player is available here again: http://pp.player.webtv.flumotion.com/params/apiKey/5PzLR2ULL3z2rumJ/videoId/60
If there are other references to the localhost, please do not bother with them, as they do not affect player functionality.
The stream that it uses is an RTMPE, so i'm afraid it will only works with this player. Anyway, the stream url is as follows: rtmpe://87.248.205.81/a4349/e2/veo7/ondemandrtmpe/mp4/med/first-person-mario-4d8741aa.mp4
I really appreciate your help!
Thank you! -
Class.forname - Unable to load class if two jars with same package name
class.forname - Unable to load class if two jars contains same package name exists in classpath.
JVM is stopping search for class one it finds the package name in the jar file that is ahead in classpath,
JVM is not continuing search in the remaining jar files.
For this , I put the jar file that contained class ahead of of ther jar file containing same package name, then it worked.
Is this a JVM bug ? (JDK 1.5)I reported as bug to sun. I got auto email, looks they have not assigned any Bug ID so far.
-
Problem with compiling a class with a package
Hello,
I am trying to implement the package example from the SUN Tutorial. It can be found on the page: http://java.sun.com/docs/books/tutorial/java/interpack/QandE/packages-questions.html
I think I am doing like described but it doesn�t work. The files are stored like following on my machine:
C:\mygame\Shared\Utilities.java (this file can be compiled)
C:\mygame\Server\Server.java (can�t be compiled)
C:\mygame\Client\Client.java (can�t be compiled)
I have no CLASSPATH set (but I tried), Java is installed in C:\Java\j2sdk
If I try to compile the file Client.java with javac the following error message occurs:
C:\mygame\Client>javac Client.java
Client.java:7: cannot resolve symbol
symbol : class Utilities
location: package shared
import mygame.shared.Utilities;
^
Client.java:23: cannot resolve symbol
symbol : variable Utilities
location: class mygame.client.Client
Utilities.printMsg("creating output stream");
^
Client.java:32: cannot resolve symbol
symbol : variable Utilities
location: class mygame.client.Client
Utilities.printMsg("writing current date");
^
3 errors
Are there any further prerequisites?
Thank youThank you for helping me. Now I am one step forward. Now I can compile each of my Java classes. But if I want to start them with java the following messages occurs. In addition I changed all pathes and class names to lower case.
C:\mygame\server>java server
Exception in thread "main" java.lang.NoClassDefFoundError: server
C:\mygame\server>cd ../client
C:\mygame\client>java client
Exception in thread "main" java.lang.NoClassDefFoundError: client
C:\mygame\client>cd ../shared
C:\mygame\shared>java utilities
Exception in thread "main" java.lang.NoClassDefFoundError: utilities
C:\mygame\shared> -
Importing class from default package of a JAR
I want to create objects of a class contained in a JAR. The JAR has many classes in numerous packages, however the class that I want to use is in the default package. I'm using eclipse and have added the JAR to the build path, but eclipse complains that the class name cannot be resolved. Is there some way to specify an import statement to look in the default package of a particular JAR? Any advice is appreciated.
jg2009 wrote:
I was under the impression that classes without a defined package were technically considered to be part of the so-called default package. But, in answer to your question, yes this class does not appear to part of any package.
Just to provide so additional information, the class that I want to instantiate is an Applet, so it is designed to be called from an html object tag, and have access to all of the other classes in its JAR. There is a system that provides access to underlying data via the following components: html form <-> javascript <-> applet <-> serverlets <-> data
I want to automate certain data operations, but the only way to access the underlying data is via the applet. Am I out of luck, or is there some way that I can instantiate the applet?All jverd said is right, assuming it is your code and you can change it: basically move everything to a package. But I think your problem is that the jar is a 3rd party jar and you cannot change it. If this is the case, you can use the 'default package' (the terminology is correct) by having your own class(es) in the default package or by using reflection (last time I tried reflection would work). Both are rather bad solutions, but if you really, really want...
Note: Java actively discourages the use of the 'default package' and more so recently, this is why I am not even sure that reflection would still work. -
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 -
Automatic Generation of classes with required attribute names
Hi ,
I am new to XML technologies ...I am having a problem in deciding whether I
should use JAXB or Castor for data binding.
The problem is the attributes I am to use are named differently as that found in
the DTD.I have creted my own classes using the required attribute names and the
n mapped them using the Castor mapping with the attributes.
I was wondering how should I achieve --"automatic generation of classes" with th
e specified attribute names?
I understand that JAXB can be used to automatically generate classes ,but this
uses the same default names as that of the XML file ..is there a way of forcing
JAXB to generate classes that use my name attributes rather than that of the XM
L dtd
If I use Castor ..is there a way to do the same.Generate Classes with the specif
id attributesHi ,
I am new to XML technologies ...I am having a problem in deciding whether I
should use JAXB or Castor for data binding.
The problem is the attributes I am to use are named differently as that found in
the DTD.I have creted my own classes using the required attribute names and the
n mapped them using the Castor mapping with the attributes.
I was wondering how should I achieve --"automatic generation of classes" with th
e specified attribute names?
I understand that JAXB can be used to automatically generate classes ,but this
uses the same default names as that of the XML file ..is there a way of forcing
JAXB to generate classes that use my name attributes rather than that of the XM
L dtd
If I use Castor ..is there a way to do the same.Generate Classes with the specif
id attributes -
Compressor crash when attempting import files with 00* in name
I produce several short video files every day and name them using a sequential five digit numerical naming convention.
I'm finding that whenever I'm near, at or shortly after crossing a 100 mark Compressor crashes when I try and import single files with the following filenames (these are the most recent examples):
20993
21000
21001
21005
The only way to import these problematic files is to select the file before, or after, then Command click on the filename causing the crash. Click Open to import both into the batch, and then click on the file I first clicked on and hit Delete to remove it from the batch, leaving the file with the problematic name.
For Example. I want to import 21005 into Compressor for processing, but every time I try and import it Compressor crashes. So I re-launch Compressor, click the little Q button and click on 21004, then press Command and click on 21005. Click Open, import window goes away to reveal the Batch window. Click on 21004, press Delete button on keyboard leaving me with the file that was causing the crash.
FWIW apart from the file duration/size, there's no difference between these files. In fact I can change the names and the files that used to import fine now crash Compressor when attempt to import with any of the filenames above.
Here's the info behind two of the problem files and also that of the two adjacent files that import fine:
(all files: Dimension: 720 x 480. Codecs: DV/DVCPRO - NTSC. Channel Count: 2. Kind: Final Cut Pro Movie File. No color labels.
20999 (Imports Fine):
File Size: 394,475,469 bytes
Duration: 01'44
21000 (Compressor Crasher):
File Size: 324,052,925 bytes
Duration: 01'26
21001 (Compressor Crasher):
File Size: 339.730.909 bytes
Duration: 01'30
21002 (Imports Fine):
File Size: 348,707,181 bytes
Duration: 01'32
Compressor 2 - 2.0.1
Dual 2 GHz PowerPC G5
1.5 B DDR SDRAM
Mac OS X 10.4.8Hello,
Thanks for the replies/info.
Yes the Panther and Jaguar install disks are retail versions, not specific machine versions. And the Jaguar ones worked for the Powerbook before.
The Powerbook I have is the Firewire 500mhz one, Pismo I think it's called. The hard drive is a 60GB one. I didn't have to partition it before.
Reviewing all the above, it would appear that the problem is me not being able to use an internal, built in CD/DVD drive to install from this time? The only other thing it could be I think is the crash I recently had has had some bad effect -- but that's unlikely right? So, I need to get a new DVD drive? Or is there any other way to get the OS onto the Powerbook without getting another internal DVD/CD drive? Is there anyway to install onto the PB from another machine maybe?
Does that sound right?: not being able to use internal DVD/CD drive is the source of my current problem?
Thanks. -
Two attached libraries with same package name
Hi everybody!
Excuse my bad english,
I have a Form (in Borms 6i) with 2 attached librairies. In these libraries, I have 2 packages and 2 procedures with the same name.
How I can call the good one in specific library?
Thanks so much
ValerieValerie,
I don't think that there is a solution for this and Forms always picks the procedure of teh library you attached first. Is renaming the functions and procedures and option ?
Frank -
Cannot compile class with a package
Hello,
I am trying to implement the package example from the SUN Tutorial. It can be found on the page: http://java.sun.com/docs/books/tutorial/java/interpack/QandE/packages-questions.html
I think I am doing like described but it doesn�t work. The files are stored like following on my machine:
D:\Test\Java\mygame\Shared\Utilities.java (this file can be compiled)
D:\Test\Java\mygame\Server\Server.java (can�t be compiled)
D:\Test\Java\mygame\Client\Client.java (can�t be compiled)
I have no CLASSPATH set (but I tried), Java is installed in C:\Java\j2sdk, I also tried D:\mygame\Shared\Utilities|Server|Client.java
The error message is:
cannot resolve symbol
Are there any further prerequisites?
Thank youThis is a minimal explanation of packages.
Assume that your programs are part of a package named myapp, which is specified by this first line in each source file: package myapp;
Also assume that directory (C:\java\work\) is listed in the CLASSPATH list of directories.
Also assume that all your source files reside in this directory structure: C:\java\work\myapp\
Then a statement to compile your source file named aProgram.java is:
C:\java\work\>javac myapp\aProgram.java
And a statement to run the program is:
java myapp.aProgram
(This can be issued from any directory, as Java will search for the program, starting the search from the classpath directories.)
Explanation:
Compiling
A class is in a package if there is a package statement at the top of the class.
The source file needs to be in a subdirectory structure. The subdirectory structure must match the package statement. The top subdirectory must be in the classpath directory.
So, you generate a directory structure C:\java\work\myapp\ which is the [classpath directory + the package subdirectory structure], and place aProgram.java in it.
Then from the classpath directory (C:\java\work\) use the command: javac myapp\aProgram.java
Running
Compiling creates a file, aProgram.class in the myapp directory.
(The following is where people tend to get lost.)
The correct name now, as far as java is concerned, is the combination of package name and class name: myapp.aProgram (note I omit the .class) If you don't use this name, java will complain that it can't find the class.
To run a class that's NOT part of a package, you use the command: java SomeFile (assuming that SomeFile.class is in a directory that's listed in the classpath)
To run a class that IS part of a package, you use the command java myapp.aProgram (Note that this is analogous to the command for a class not in a package, you just use the fully qualified name)
Here is a reference: http://java.sun.com/j2se/1.4.1/docs/tooldocs/findingclasses.html -
Importing classes from default package
hey all,
I've just started a new job, and find myself having to use a library that is written in the default package. At the moment, this is forcing me to put my classes in the default package whenever I want to use this library.
using a line like:
import RowBean;
I get the following compiler error:
[javac] C:\work\coyote\src\java\com\sok\coyote\Grievance\GrievanceActionServlet.java:8: '.' expected
[javac] import RowBean;I've tried classic,modern and jikes - all with the same error.
Eclipse seems to compile this happily, but I've been unable to find what it does to compile it.
any ideas?
cheers
dimThis works for me in 1.3.1_07
DefaultPackage
public class UseMe
public static final String test = "Yes";
}Package = fun
package fun;
import UseMe;
public class Fun
public static void main( String[] args )
System.out.println( UseMe.test );
} -
Importing classes with embedded java
I have the following line of code:
Element input = (Element)getVariableData("sourceString");
I'm trying to get the value the the variable 'sourceString' from the bpel process. When I try and compile I get the error:
class bpel.testmq.Element not found.
testmq is the name of my bpel process.
I have tried using javax.lang.model.Element, and org.jdom.Element with no success.
cheers
JamesFinally, I think I have figured out all my java issues.
to import java classes all you need to do is enter the following in the source code of your bpel process. This is places after the last line of the process and before the partner links.
<bpelx:exec import="java.util.*"/>
<bpelx:exec import="java.lang.*"/>
<bpelx:exec import="java.rmi.RemoteException"/>
<bpelx:exec import="javax.naming.NamingException"/>
<bpelx:exec import="org.w3c.dom.Element"/>
<bpelx:exec import="java.math.*"/>
cheers
James -
Importing classes with unnamed namespace
Hi,
I'm currently assigned to a class assignment that requires me to build a calculator bean using a class that was provided. Problem was, we were expected to import the provided class in an unnamed namespace - something that was possible in SDK 1.3 but not in 1.4. Recompiling the source for the class is out of the question, since the source code wasn't provided and the lecturer refused to do so - instead, he told my class to go back to SDK 1.3. But I already have the latest SDK(1.4.1_01) installed, and I do not intend to go back to an older version of the SDK or have both SDK installed side-by-side. Is there any known workaround to make the compiler ignore unnamed namespaces? Please help.since the source code wasn't provided
and the lecturer refused to do so - instead, he told
my class to go back to SDK 1.3. And you might also keep in mind that the lecturer might be incompetent since he refused to provide and updated version and could not provide a suggestion on how to do it with 1.4. So be careful about everything he tells you. -
To access a method frm a class derived frm a base class with the same name
Here' s an example:-
class TestA {
public void start() {
System.out.println("TestA");
class TestB extends TestA {
public void start() {
System.out.println("TestB");
}In main method I do this:-
TestA testA = new TestA();
TestB testB = new TestB();
((TestA)testB).start();Output :-
TestB.
Now when i define the method as static :-
class TestA {
public static void start() {
System.out.println("TestA");
class TestB extends TestA {
public static void start() {
System.out.println("TestB");
}Then output is :-
TestA.
Can anyone let me know that when i say ((TestA)testB).start(); i.e i am type casting TestB obect to it base call then TestA should be printed but it doesn't print but when i declare method as static is does print TestA.
Thanks,
Heena>
>
Secondly, when i say ((TestA).testB).start(); output is TestB. But when i define start() method as static output is TestA. I need clarity for the same.In the static case, all that the compiler is interested in is the class of the expression before the ".". Because you've put in an explicit cast the type of expression is assumed to be TestA the compiler doesn't know what kind of object will actually be referenced at runtime. In the static case which method is called is determined at compile time.
In the instance method case what determines the method called is determined the class of the actual, run time, value of the expression, and despite your cast, the actual value is still a reference to a TestB instance, so the TestB method is called. In the instance case which method called is determined at run time.
Maybe you are looking for
-
I am currently using a late 2006 black macbook running OS Lion. I have recently bought a new retina macbook pro to upgrade to which will presumably be running OS Mountain Lion. I understand there are several ways to transfer data across to new macs a
-
Physical and Logical Structures of DB
Hi all Why datafiles are called physical structure of database and tablespace,segment etc are called logical structures of database as datafile is also a name given to memory area on disk drive ,therefore it should also be called logical structure
-
How could i use my three external Display's as one Big?
I'have an Mac Book Pro 15,4" and i would use My three external Display's as one!! How can i do that without using an Adapter? The external DIsplay's are Connectet by the two integrated Thunderbolt adapter and one is connected by the integrated HDMI a
-
I connected my mac to my tv. Video is good. Sound is good when I'm running itunes. Problem is that if I try to watch videos (Hulu, Netflix, youtube, etc.) there is no sound. Need some help.
-
What BI-object must be changable when saving a Broadcasting object ?
HI, I want to save a Broadcasting-Object (e.g. a query with given variables using e-mail). Before I can schedule the job, I have to save my settings.Whenever I try this, it's telling me that the system is not changable and I need to open it by using