I'm trying to create a portable environment (USB Flash/Disk) that can be copied from one device to another - and work "out of the box" on a Mac/OSX (10.10.x environment) specifically. My purpose for this, is I'm teaching a "Portable Programming" class next semester, and I want to be able to just copy (or give the student a .zip file), have them expand it on a specifically named volume, and the environment works. This includes the SDK version(s), AVDs, etc. I've got everything apparently working (so far), but have a problem with the AVDs.
This is a new install, using latest Eclipse, etc.
I'd hoped to find these directories, etc. within an XML/INI file, and use an editor or sed to change the strings, but can't seem to find the directory names of anything I've needed to change so far within an XML/INI file within the unzipped Android directory - but don't see them.
I do see a reference within Preferences->Android->Build "Default debug keystore" that references ~./android - but it is not editable. There IS a "custom" debug keystore setting on the same dialog page, but changing it does not seem to have an effect on the AVDs and their location. So far, that's the ONLY reference I've found for my home directory. I've looked at the Eclipse CLI at eclipse.org, but don't seem to see anything relating to this issue (at least not anything that's ringing a bell with me).
So - how can I change my default "home" directory (without boogering up the environment, etc.) for Eclipse/Android, so my AVDs (and whatever else I HAVEN'T run into yet), can be installed and used/run from the USB drive/stick?
Please - I DO NOT WANT links to other "portable" packages, as I'm not sure what's actually been altered in them (and probably not current, and an update is likely to hose everything anyway), and don't want to pass along anything to students. I'm downloading official packages from official locations, and want to keep it that way. So I'm only looking for things that can be fixed/edited within an officially installed environment to get the effect I'm looking for. Thanks!
Found this at Launch mac eclipse with environment variables set
There is an alternate solution which involves replacing the executable that is run by MacOS X when the user launches the Eclipse application with a shell wrapper that sets up the environment.
Create an empty text file called "eclipse.sh" in the Eclipse application bundle directory /Applications/eclipse/Eclipse.app/Contents/MacOS.
Open the eclipse.sh in a text editor an enter the following contents:
#!/bin/sh
export ENV_VAR1=value
export ENV_VAR2=value
logger "`dirname \"$0\"`/eclipse"
exec "`dirname \"$0\"`/eclipse" $#
In the example ENV_VAR1 and ENV_VAR2 are the environment variables being set up. These variables will be visible to processes launched from within Eclipse. The logger command will just log the path of the eclipse executable to the system.log as a debugging aid.
In the Terminal set the executable flag of the shell script eclipse.sh, i.e.:
chmod +x /Applications/eclipse/Eclipse.app/Contents/MacOS/eclipse.sh
Open the Eclipse.app Info.plist and change the value for the key CFBundleExecutable from eclipse to eclipse.sh.
MacOS X does not automatically detect that the Eclipse.app's Info.plist has changed. Therefore you need to force update the LaunchService database in the Terminal by using the lsregister command:
/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -v -f /Applications/eclipse/Eclipse.app
The next time you launch Eclipse.app from the Dock or from the Finder the environment variables should be set.
It took me a while to research, as that info was from Sep. '09, which was back in Snow Leopard (OSX 10.6) days. I'm now running 10.10, and while some things don't change - a LOT has changed, so it took a while to research the above approach and make sure it wasn't going to do some potential damage to the installation. A LOT of under-the-cover stuff has changed in those 4 versions, and I wasn't willing to just take off with it. I've also not found a good explanation of exactly what ANDROID_SDK_HOME actually controls - although this above approach seems to work - so far.
Related
I'm building a simple calculator app from a tutorial/class on Pluralsight (Java Fundamentals class), which starts with a Main.java file, and adds a class file later, MathEquation.java.
I created a Git repo to track my progress, and uploaded to Github: JavaFundamentalsClass. I used GitIgnore.IO to find a Java IntelliJ .gitignore file, and everything seemed to be working fine on the original PC I was using.
However, after switching over to a different PC, with a fresh install of IDEA, I cloned down the repo from Github, and found that the project would not build and/or run. I get this error:
"C:\Program Files\RedHat\java-1.8.0-openjdk-1.8.0.191-1\bin\java.exe" -Dfile.encoding=windows-1252 -jar ""
Error: Unable to access jarfile
Process finished with exit code 1
I suspect that there is something in the .gitigore file that is keeping some of the project, dependency, or build information from being saved in the repo that keeps IDEA from having all the info it needs to build and run the Main.java correctly.
Can anyone help? You should be able to download the project from the repo linked above in it's currently broken state, including the .gitignore file.
Additional Info
I wiped my repo clean and recloned and I forgot, originally it doesn't even give me the run button (it is grayed out). I had to do a procedure with "Add Configuration" from a search I did for that to show up to get the error above.
Also, I did install java from the OpenJDK, rather than oracle. I figured with Oracle cutting off commercial development maybe start the switch now as I'm learning, but maybe that's the issue (normal Java on my other PC).
It's working, but...
First thing - Intellij needs to know where Java is. It appears that if the SDK/JDK is not installed prior to Intellij, you will need to tell it where Java is after installing. Or if you use OpenJDK instead of Oracle Java SDK. You can do that at View/Open Library Settings, under Platform Settings / SDKs (select the JDK home path).
Then, after setting up Java, I am able to get everything working in Intellij IDEA if I find the Main.java file, right-click, and choose "Run main.main()". This runs the program okay, and also creates a Main configuration in the Run/Debug configuration area, and finally the "Run" button becomes available.
So I can get it working, but if I wipe all the files and clone it fresh from the remote repo, I have to go through running the Main.java file directly again to recreate the configuration.
So, this still doesn't answer my original question. Why doesn't this configuration get saved in the repo? What file is this information saved in? Is there something in the .gitignore file that is keeping this information from being saved to the repo?
Look like you have a different java version on your second machine.
First of all, check your java version
Update the configuration of your project, right now it pointing to java 1.8
https://github.com/LightCC/JavaFundamentalsClass/blob/master/.idea/misc.xml
I think it might be because of java not installed on the other PC you were trying. If it is installed just check whether the path mentioned has java executable file.
The first part is ensuring Java is setup, and that Intellij IDEA knows where Java is, per the other answers, comments, and addendums to the question.
The second part is setting up the run/debug configuration, per the "It's working but.." section of the question. This can be created automatically by right-clicking the file that has the main class to be run (usually Main()...), and selecting the "Run Main.main()" option (replacing Main and main() with the file and function which needs to be run)
The final piece is that to get the run/debug configurations to save to the repo, you either need to:
Share the workspace.xml file (i.e. make sure this is not in the .gitignore file). However, there is a lot of user-specific stuff in that file, so it should normally be excluded from the repo.
Or, edit the configuration and checkmark the "Share" box in the upper right-hand corner (just right of the "Name" field). This will put the configuration into a separate folder inside the .idea folder, which should not be excluded from the repo by .gitignore.
I just started working with Cordova/PhoneGap and when I want to use the command "cordova run android" on my newly created application, it goes somewhat like this:
C:\Users\tobbog\Desktop\MyNewApp>cordova run android
ANDROID_HOME=C:\Users\tobbog\AppData\Local\Android\sdk
JAVA_HOME=C:\Program Files\java\jdk1.8.0_144
The system cannot find the path specified
However, the two paths above are both perfectly like that in my Environmental Variables. How can it be that it doesn't find the path?
Thanks in advance for any help!
Remove android by the below command
cordova platform rm android
Then add the version 5 by the below command
cordova platform add android#~5
That should help!
You may also want to place the paths in quotation marks " ", since it's possible the space in "Program Files" is throwing it off, I know this happens often when trying to run certain programs via command line that take file arguments. So maybe write it like this:
C:\Users\tobbog\Desktop\MyNewApp>cordova run android
ANDROID_HOME="C:\Users\tobbog\AppData\Local\Android\sdk"
JAVA_HOME="C:\Program Files\java\jdk1.8.0_144"
Can't be 100% sure though as I'm unfamiliar with what that program expects (cordova) and other options that may be supplied to it! You could always try checking the readme or documentation related to that program, it probably shows some examples as to how to run something similar.
See how it even changes in the Stack Overflow text formatting? It's possible once it hits that white space after Files (in C:\Program Files) that it's ignoring the rest of the path, so basically you're trying to specify this path for JAVA_HOME:
C:\Program
And that's it! Would explain why it can't find that path since you probably don't have just a "Program" directory!
I found the answer to my problem! The problem was that I installed and uninstalled the Android Development Kit before. During the uninstal, it didn't delete all of the folders so that I had to delete them manually before installing Android again.
I installed Netbeans on OSX Mountain Lion running JDK 7. Everything was working fine. Then my machine for no reason crashed. After this I could no longer open Netbeans anymore.
If I try to start Netbeans from the commandline:
/Applications/NetBeans/NetBeans 7.2.app/Contents/MacOS/netbeans
Then it works fine. From there I can select Netbeans > About and confirm that my userdir and cachedir is:
User directory: /Users/<user>/Library/Application Support/NetBeans/7.2
Cache directory: /Users/<user>/Library/Caches/NetBeans/7.2
So, I deleted these directories and tried again, but alas, I can only start netbeans via the commandline.
Ideas appreciated...
Sounds to me like this is not a NetBeans problem at all, rather a problem with the bundle, such that OS X is not launching the app as it should.
To verify, I'd try opening NetBeans through Finder from the command line:
open -a "NetBeans 7.2.app"
This command will ask the system launcher to open the application as if you had clicked on the icon. In your case, it probably won't open. If this is true, then you know it's not something in your terminal environment that's allowing NetBeans to launch.
The next step that I would take would be to look at the package contents: examine /Applications/NetBeans/NetBeans 7.2.app/Contents/Info.plist for anything that seems amiss - this file is the information store that OS X looks for to see how to launch the package, what its icon is, etc... - in particular, I think you should look at the CFBundleExecutable value to see what command is used to launch the app. If it's not netbeans, you've found a big hint on what might be amiss: bundles are set up so that launchers should run bundle_dir.app/Contents/{platform}/{CFBundleExecutable_value}. Looking at CFBundleExecutable should show you if there's some other script used to launch the app than just running netbeans.
From this point, you'll have to do more digging, but hopefully this is enough information for you to get started tracking down how apps are launched from the OS X launcher. For more info and a better reference, check out this link, which is Apple's documentation for keys in Info.plist.
Finally, you should note that the launch information for all apps are heavily cached; I've heard that if you make a change to Info.plist, you have to rename the app bundle and name it back to have the changes picked up by the launcher.
Good luck!
Here's an idea: use Eclipse >=)
..but seriously, something got corrupted in Netbeans' metadata/cache data files. You cleared a couple of them but there may be others elsewhere.
Try comparing the launch command in your shortcut to what you're typing in the console. Are they the same?
To find the root cause, I would check the NetBeans logs, as detailed here
/Users/yourname/Library/Application Support/NetBeans/7.2/var/log/messages.log
And if that doesn't help, I'd archive your project(s) and put a clean install of NetBeans on your machine, and then import the archived project(s) back into NetBeans.
Product Version: NetBeans IDE 6.8 (Build 200912041610)
Java: 1.6.0_17; Java HotSpot(TM) Client VM 14.3-b01
System: Windows 7 version 6.1 running on x86; Cp1252; en_GB (nb)
Hello, newbee java programmer here and wondering if someone can help, I have been having some problems updating a GUI for a desktop application in netbeans, here are the details:
my current application GUI works great, everything is appearing correctly.
when I update the GUI by adding a new label from the netbeans toolbox onto my form, and use the netbeans preview function, everything looks great
however when i run the application the new label has disappeared..
to try and understand the problem i ran the app in debug mode and stepped through the auto-generated initComponents() code
from debugging i believe the problem comes from this line of code:
TEST_lbl.setText(resourceMap.getString("TEST_lbl.text")); // NOI18N
after this line of code has executed TEST_lbl.setText is equal to null..
so the label is disappearing when i run the app because it has no text value to display...
i opened the resource map file in notepad (the .properties file) and it contains an entry "TEST_lbl.text=jLabel1" among the entries for all the other working controls...
so the properties file has the correct value, but resourceMap.getString is not retrieving it
i can work around this problem by changing the "Automatic Resource Management" option of the form from "All Resources" to "Off"
as a result this changes the auto-generated "setText" code line to:
TEST_lbl.setText("jLabel1");
and makes the label display correctly when the application runs
my first question would be, is this a known bug? or have i done something silly and accidently changed a setting someware?
if this is not a bug, how do i correct the problem without changing the resource management setting?
if this is a bug, what are the implications of turning off automatic resource management?
Thanks for the help, - Gaz
I assume you're running it under NB (Run > Run Main Project)?
Try a clean build (Run > Clean and Build Main Project). That will usually fix it.
It's an issue of how the build system is structured.
When you run the project in a clean repository (Run > Run Main Project):
the .class files are written to $project/build/classes
the non-class files are copied into the tree
the whole thing is run from there.
That works fine.
If you "build" the project (Run > Build Main Project):
1. the .class files are written to $project/build/classes
2. the non-class files are copied into the tree
3. the whole thing rolled up into a jar file.
That also works fine.
However, if you subsequently make changes and run the project, the class files and resources now appear in 2 places:
in build/classes
in the dist/project.jar
This works OK as far as finding class files. Resources, however, are found in the jar first. So, at runtime, you code finds the outdated copy of the properties file in the jar, not the new one in the filesystem.
Also: NB ignores case when finding a resource, but Sun's JVM does not (not sure about IcedTea). So, if the wrong case is used NB may insist the file is there, but the JVM will not be able to find it.
Hello I am looking to install Apache-Tomcat on a RedHat linux and I am interested if there is a standard place for this to be installed. in other work I have seen tomcat installed at
/opt/apache-tomcat-[VERSION]/
but I would expect it to be found under /usr.
Best answer will have a link to authoritative site.
Thanks so much,
David.
I don't know if there's such a thing as an "official" place, but a reasonable thing to do would be to do what you've done and refer to tomcat through a softlink at /usr/local/tomcat or some such, which would allow you to upgrade versions by simply installing a new version in opt and changing the softlink.
It depends on who you ask, but I see it this way:
/opt is typically for third-party add-on software. /usr/ is often for 'system' software. User compiled apps go in /usr/local.
I put tomcat in /opt/apache-tomcat-VERSION. I then make a symlink to it as /opt/tomcat.
The Linux Standards Base may have more info on the matter.
There's a Red Hat RPM package for Tomcat 6 - just "yum install tomcat6" and it will put everything in the right place for you and fix up the security by running Tomcat as a dedicated user (not to mention taking care of updates and patches by putting Tomcat into the RPM repository).
Most of the executables, the configuration and the webapp directory end up under /var/lib/tomcat6 using this method.
Someone else mentioned http://www.pathname.com/fhs/pub/fhs-2.3.html, which is good information. Unfortunately, they didn't provide any accompanying information with it, aside from a snarky comment.
According to that document, /opt is where installed software would go, so I would recommend /opt/tomcat, and set CATALINA_HOME to this directory.
It also says /var is where variable data would go, so I would put it in /var/tomcat and set CATALINA_BASE to this directory.
I'll add a little background. If you don't set CATALINA_BASE, then it will default to the same as CATALINA_HOME. However, CATALINA_HOME should be the unadulterated install, and should be set as read-only. You should use a different location for variable stuff like your actual web directories and logs. Then, when you need to change versions, it's just as simple as changing CATALINA_HOME. Also, you can run multiple instances of Tomcat more easily without having multiple copies of the same install.
Also, don't forget to create a CATALINA_BASE/bin/setenv.sh (or .bat for Windows) file instead of editing CATALINA_HOME/bin/catalina.sh (or .bat for Windows).
Yeah, this is more information than anyone asked for, but hopefully someone will find it useful.
Well there is an easy answer for that here, too bad nobody of these high-pointers have listed it:
http://www.pathname.com/fhs/pub/fhs-2.3.html
I'm fairly certain it doesn't matter.
Just like most well-behaved Java apps look for the JAVA_HOME environment variable to locate the preferred Java installation, once you've set CATALINA_HOME in either .bashrc or .profile of the affected users, software needing to locate Tomcat should be able to find it.