"The shell stopped unexpectedly and Explorer.exe was restarted."
Ik weet alleen dat het niet in System.getProperties() staat, tenzij je die zelf specificeerd (zoals bv JAVA_HOME of ANT_HOME),
More than meets the eye
There is no I in TEAM... but there is ME
system specs
"The shell stopped unexpectedly and Explorer.exe was restarted."
Daarmee kun je dingen uit het classpath openen en java zoekt ze dan zelf op
"The shell stopped unexpectedly and Explorer.exe was restarted."
Neem je whisky mee, is het te weinig... *zucht*
Ik heb gewoon een aantal class files in een directory. 1 daarvan is een Application welke ik start met NetBeans. Vervolgens vraag ik user.dir property op en print deze naar System.out. Ik krijg dan de directory waarin NetBeans staat geinstalleerd terug.
"The shell stopped unexpectedly and Explorer.exe was restarted."
En als hij in een jar bestand zat, hij ook die bij/in het pad meenam
let the past be the past.
geeft een URL terug die naar de class files verwijst.
of werkt dit alleen bij applets?
veel info hier: [rml]FlowDesign in "[ Java] Subclasses vraagje"[/rml]
Mustang Mach-E SR RWD | MINI Countryman (F60) Cooper S (Stage 1 tuned)
"The shell stopped unexpectedly and Explorer.exe was restarted."
1
2
3
4
5
6
| private String getProjectFolder() {
String myClassFile = getClass().getName() + ".class";
URL url = getClass().getResource(myClassFile);
File file = new File(url.getPath()).getParentFile();
return file.toString();
} |
Alleen deze geeft het path terug met URL formaat, dus met %20 enzo. Ik moet het path hebben met spaties en slashes escaped. Zoiets als dit:
C:\\Projects\\MyProject\\Classes\\
"The shell stopped unexpectedly and Explorer.exe was restarted."
"The shell stopped unexpectedly and Explorer.exe was restarted."
Ik snap ook niet waarom dit zo moeilijk moet? In Delphi is het heel simpel:
ExtractFilePath(Application.ExeName);
"The shell stopped unexpectedly and Explorer.exe was restarted."
"The shell stopped unexpectedly and Explorer.exe was restarted."
Verwijderd