How to control class file access
Hi
I am developing an application in java. I am keeping only one class where the user has to enter valid password. different classes are called later as soon as the user run the application. I guss, any one can access other class even those has not main class by way of writing a new class having main method and calling all other class from that class. Will any one suggest how do I protect it?
Thanks in advance
package mypackage;
public class myEntryClass { // public as this class is the only one that is to be used by others
private boolean isLoggedIn; // no one can change this value except myEntryClass
public myEntryClass() {
public final void login(String user, String password) { //anyone can attempt to login - the mehod may not be overridden however by subclasses as it is final
if ( /* check if username and password is ok */ ) {
this.isLoggedIn = true;
public void callAMethod() { // anyone logged in may do so
if (this.isLoggedIn) {
AnotherClass.aMethod();
package myPackage;
class AnotherClass { // package/default visibility
static void aMethod() { // package/default visibility
// do something
Hope that helps
rh
Similar Messages
-
How to convert .class file to exec file...
hi.
how to convert .class file to exec file...
please explain me clearly.....
thanks...Placing your exact "question" into google:
http://www.google.com/search?q=how+to+convert+.class+file+to+exec+file... -
How to include class files in no package?
hi,
I have a class file in a package called
pack.Test
and a class file not in a package called
Library
When I try to use Library from within pack.Test, it says theres no such class. I have my classpath setup correctly, and the files in the correct directories.
ie. on windows if %DIR% is the base directory then
%DIR%\Library.java
%DIR%\pack\Test.java
is how they are layed out.
Is there a way to get Library imported to pack.Test?
thanks,
asjfWhat?!! It isn't considered legal to access a
root-level class from a higher level package?Well it's not now because your code won't compile, but
prior to 1.4 you could. I think the JLS has been
updated to say you can't import from the unnamed
namespace.Hmm! I must have missed that bit (not that I read it in any great detail, anyway!). I suppose it forces you to use packages, which is a good thing, IMHO.
What I was wondering about was, is the directory structure of classes strictly necessary, given that a class contains information on its package anyway? I know some IDEs don't require the source files to be in the right directory - they will check on the package statement, and locate the class file accordingly - but is it absolutely necessary for class files to be located according to their directory structure? I know the JLS says they have to be, but could the JLS be relaxed on this point, without breaking anything?
RObin -
Hi all, I am new in java card development.
This is my environment setting:
@echo off
set JC_HOME=C:\JavaCard\java_card_kit-2_2
set JAVA_HOME=C:\j2sdk14103
set PATH=.;%JC_HOME%\bin;%PATH%
I have created the Wallet applet according to 'Zhiqun Chen" text book and named it WalletApp.java.
I have compiled this file to a class file.
This is where is I saved my file
C:\JavaCard\java_card_kit-2_2\samples\src\com\sun\javacard\samples\WalletApp\WalletApp.java.
But I don't really understand how to convert the class file.
May I know what is this for?
-out EXP JCA CAP
-exportpath
-applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x1:0x1
com.sun.javacard.samples.HelloWorld.HelloWorld
com.sun.javacard.samples.HelloWorld
0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x1 1.0
must save this in what file?
I tried to type in the command line below (and the result):
C:\JavaCard\java_card_kit-2_2\samples>converter -config scr\com\sun\javacard\sap
les\Wallet\Wallet.opt
error: file scr\com\sun\javacard\saples\Wallet\Wallet.opt could not be found
Usage: converter <options> package_name package_aid major_version.minor_ver
sion
OR
converter -config <filename>
use file for all options and parameters to converter
Where options include:
-classdir <the root directory of the class hierarchy>
set the root directory where the Converter
will look for classes
-i support the 32-bit integer type
-exportpath <list of directories>
list the root directories where the Converter
will look for export files
-exportmap use the token mapping from the pre-defined export
file of the package being converted. The converter
will look for the export file in the exportpath
-applet <AID class_name>
set the applet AID and the class that defines the
install method for the applet
-d <the root directory for output>
-out [CAP] [EXP] [JCA]
tell the Converter to output the CAP file,
and/or the JCA file, and/or the export file
-V, -version print the Converter version string
-v, -verbose enable verbose output
-help print out this message
-nowarn instruct the Converter to not report warning messages
-mask indicate this package is for mask, so restrictions on
native methods are relaxed
-debug enable generation of debugging information
-nobanner suppress all standard output messages
-noverify turn off verification. Verification is default
*********************************************************May I know What is the correct command line to convert the class file and what must I do to before converting the class file?
I saw some article saying we must use JDK1.3, is it a must?
Your solution is highly appreciated.
Thank you!Hi Ricardo,
I saved the file below as WalletApp.opt in the directory of scr\com\sun\javacard\samples\WalletApp
-out EXP JCA CAP
-exportpath c:\javacard\java_card_kit-2_2\api_export_files
-applet 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x2:0x1 WalletApp.WalletApp
WalletApp 0xa0:0x0:0x0:0x0:0x62:0x3:0x1:0xc:0x2 1.0
But I still have the problem below:
C:\JavaCard\java_card_kit-2_2\samples>converter -config scr\com\sun\javacard\sam
ples\WalletApp\WalletApp.opt
error: file scr\com\sun\javacard\samples\WalletApp\WalletApp.opt could not be fo
und
Usage: converter <options> package_name package_aid major_version.minor_ver
sion
OR
converter -config <filename>
May I know What's wrong with my command or file?
Where can I download JDK because what I can find is J2SDK.
Thank you! -
How to convert class file into exe
I have made a simple calculator using swing.now i want it to be used as an application from the desktop..How can i do it?..any suggestions?
raghu0007 wrote:
I have converted the class file to jar using jar cvf simplecalci.jar simplecalci.class.
Now i don't know wat to do next since when i double click the jar.....windows shows the message
Failed to load Main-class manifest attribute from c:\users\raghu\simplecalculator\build\classes\simplecalculator\simplecalci.jar
I am using netbeans and i have JRE 5 as well as JRE 6 installed.
I don't knw wat to do.Netbeans creates the .jar file for you,
Simply right click on the project node in nb and select
clean and buildnext goto the location of the project
Eg:
C:\Documents and Settings\raghu0007\My Documents\NetBeans Projects\SimpleCalculcator\dist\There will usually be 2 files in there, 1 for the Gui parts and the other(.jar) the rest.
These two files must always be together (same directory for the jar file to work)
copy the dist folder to C:\Program Files\, Rename it and create a shortcut to the simplecalci.jar file
If you know the above just take a look at how you modified the MANAFEST file and the file(MF,class...) locations in the .jar
For Windows XP
Edited by: gtRpr on 2008/06/20 09:48 -
How to add class file to the project in netbean
Hi,
I am not sure if it is the right place to put the question. I just cannot find the way to add my existing java class file into the project in net bean.
Anyone can help?
Thanks a lotLook at the "classpath" entry on the Index tab in NB's Help. There are entries there that explain how to add existing classes and libraries to a project.
-
How to get *.class file path....
how could find the executable file path at execution time..
if there is one *.class file, then i will paste it to another location . next i will execute that .class file. how to find that path from execution program ....Try the following
URL path = getClass().getProtectionDomain().getCodeSource().getLocation(); -
How to include class file in applet
I would like to include a class file into my applet gui.
As it were like inserting an applet into an applet.
How do i make this happen?
I have made my interface in netbeans, is there an easy way for this?to do that you have to call the your class constructor in the applet
same like as we do in main method ...
call it under the init method -
How to call class file from jsp without creating packages
i m using tomcat 5.5
i stored my class file into WEB-INF\Class directory
how to call that class file. from my jsp page.
i got some error.
i used package concept,that works fine.i m using tomcat 5.5
i stored my class file into WEB-INF\Class directory
how to call that class file. from my jsp page.
i got some error.
i used package concept,that works fine.Then use packages.
As of Java1.4, you can no longer import classes from the default package (no package declared) into classes that are packaged.
All Tomcat classes are in packages, including the compiled JSP.
Therefore: Your classes need to be in a package inorder to be imported and used by the JSP.
Why the problem? If you know it works with packages, why try not to use them? -
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 decode .class files to .java files?
I just want to know that how can I decode .class files back to .java files?
If anybody can tell, it will be of great help.On a related note, how can I make it such that this cannot be done?
I understand the format is not private so it's not impossible for someone to go backwards.
I'm also aware of some programs that alter your source to make it more difficult for people to understand after decompiling it.
Regards,
Nick G. -
How to extract .class files?
Hello,
I have four .class files I need to take a look inside, and manage the files. How may I go about doing this? I am not a programmer so I will not understand code. Is there any free app that works and extracts .class files? I have tried RAR Extractor Free and The Unarchiver, but none worked.
Please help!Why bother? Just distribute the 3rd-party JAR as it is. All it costs you is a little disk space. Why bother to look inside, understand which classes you do and don't need, repackage, ... repeat every 3rd-party release? repeat for every 3rd-party product?
Just ship it the way they ship it. -
How to convert class file to Java source code ?
Hi All ,
Currently am working in Peoplesoft Demo project using java as Plug in.We have only the class files and jar files and we have planned to modify the code for future enhancements.We dont have any legal issues here as we are already working with our client for the original source code.
Kindly help me out in doing this reverse engineering process.We have come to know the below steps would help us out.Can someone guide us in acheiving this process step by step.Please add your experience here and let us know what are the other steps required ..
(1)Rename the file from .jar to .zip and extract the .zip file.
(2)Decompile the desired .class file using 3rd party tool and get .java file.
(3)Modify the .java file and compile it.
(4)Now zip the extracted files and rename the it from .zip to .jar.
We need to verify whether the modified .jar file will work
Thanks & Regards
Kar1983Thanks for your reply ....We have asked them so many times ..but they say they dont have it .Since we have planned to do some enhancements from our end we have planned to do reverse engineering process.
-
How to convert .class file to .dll file
hi,
I got a problem, I have to convert my java .class file to .dll file. Microsoft VC++ program will invoke the converted .dll file.
Is there any other possibility.
I was confused.
Cam any body help me. If you are having solution for the can you send to my [email protected] account.
thanks,No, it is not possible to do what you are suggesting. Yes, you could produce a DLL that wraps the JVM and loads your java class exposing a C and/or C++ callable interface, but that is a lot to go through unless your class is VERY complex. Otherwise, you might want to just create and maintain two implementations.
-
How to convert .class files to .java files
Hi,
I want to convert .class files to .java files. Is there is any software for that doing except Dj DCompiler? Because if i am using this i am not getting proper code i mean as it is available in the file.
I tried by writing simple java file and i compiled Sample.java file and i got a .class file then i converted this Sample.class to Sample.java file by using DjDcompiler but i was missing some statements i need entire code that is available in Sample.java file. Please tell me any other software for that doing.
Thank you in advanceI want to convert .class files to .java files.
iles. Is there is any software for that doing except
Dj DCompiler? Because if i am using this i am nothttp://www.google.com/search?hl=en&q=java+decompiler&meta=
getting proper code i mean as it is available in the
file.I doubt you ever will.
I tried by writing simple java file and i compiled
Sample.java file and i got a .class file then i
converted this Sample.class to Sample.java file by
using DjDcompiler but i was missing some statements i
need entire code that is available in Sample.java
file. Please tell me any other software for that
doing.Did you hear about "compiler opimizations"?
Maybe you are looking for
-
Some of my iPhoto albums will not show, as below: When I click on any of those individual albums, for a brief split second I can see the images displayed, but then they revert to this: Then if I click on any of those images, this image appears: I hav
-
My phone is not showing up as a device on Find iPhone
I have a phone and an ipad. When I go to Find Iphone to try to add my device, I cannot. I have turned on the locations settings, I have rebooted, I have updated my iCloud password and turned "on" everything that needs to be on. I have seen no fixes o
-
XSL transformation exception when using it in a subprocess
Hi all I want to use a service task in sub-process that call a function with ref_cursor return type, when i map data association from output parameters to data object with xsl transformation an exception raise. in other hand my sub-process properties
-
I have a table with the first 3 colums below. Is there a way to generate the fourth column? I need to string together the location by date (asc). if the location does not change, then I do not string the data. There should be one path per ID. I have
-
Can I use Lumia 920 charger to charge Lumia 925 ?
I used tonight my friend Lumia 920 charger (EU ver) to charge my Lumia 925 for a little bit, is this safe for my 925 ? Thx.