Created
April 14, 2009 20:49
-
-
Save knowtheory/95421 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >> import com.google.appengine.tools.info.SdkInfo | |
| NameError: cannot initialize Java class com.google.appengine.tools.info.SdkInfo | |
| from /Users/ted/Code/jruby/lib/ruby/1.8/irb/ruby-token.rb:46:in `get_proxy_or_package_under_package' | |
| from /Users/ted/Code/jruby/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:51:in `method_missing' | |
| from (irb):13:in `irb_binding' | |
| Maybe IRB bug!! | |
| >> import Java.com.google.appengine.tools.info.SdkInfo | |
| NameError: cannot link Java class com.google.appengine.tools.info.SdkInfo, probable missing dependency: null | |
| from /Users/ted/Code/jruby/lib/ruby/1.8/irb/ruby-token.rb:46:in `get_proxy_or_package_under_package' | |
| from /Users/ted/Code/jruby/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:51:in `method_missing' | |
| from (irb):14:in `irb_binding' | |
| Maybe IRB bug!! | |
| >> import Java::com.google.appengine.tools.info.SdkInfo | |
| NameError: cannot link Java class com.google.appengine.tools.info.SdkInfo, probable missing dependency: null | |
| from /Users/ted/Code/jruby/lib/ruby/1.8/irb/ruby-token.rb:46:in `get_proxy_or_package_under_package' | |
| from /Users/ted/Code/jruby/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:51:in `method_missing' | |
| from (irb):15:in `irb_binding' | |
| Maybe IRB bug!! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.google.appengine.tools.info; | |
| import java.io.File; | |
| import java.net.*; | |
| import java.security.CodeSource; | |
| import java.security.ProtectionDomain; | |
| import java.util.*; | |
| // Referenced classes of package com.google.appengine.tools.info: | |
| // LocalVersionFactory, Version | |
| public class SdkInfo { | |
| public SdkInfo() { | |
| } | |
| static List toURLs(List files) { | |
| List urls = new ArrayList(files.size()); | |
| File file; | |
| for(Iterator i$ = files.iterator(); i$.hasNext(); urls.add(toURL(file))) | |
| file = (File)i$.next(); | |
| return urls; | |
| } | |
| static URL toURL(File file) { | |
| try { | |
| return file.toURL(); | |
| } | |
| catch(MalformedURLException e) { | |
| throw new RuntimeException((new StringBuilder()).append("Unable get a URL from ").append(file).toString(), e); | |
| } | |
| } | |
| static List getLibs(File sdkRoot, String libSubDir) { | |
| File subDir = new File(sdkRoot, (new StringBuilder()).append("lib").append(File.separator).append(libSubDir).toString()); | |
| if(!subDir.exists()) { | |
| throw new IllegalArgumentException((new StringBuilder()).append("Unable to find ").append(subDir.getAbsolutePath()).toString()); | |
| } else { | |
| List libs = new ArrayList(); | |
| getLibs(subDir, libs); | |
| return libs; | |
| } | |
| } | |
| static void getLibs(File dir, List list) { | |
| File arr$[] = dir.listFiles(); | |
| int len$ = arr$.length; | |
| for(int i$ = 0; i$ < len$; i$++) { | |
| File f = arr$[i$]; | |
| if(f.isDirectory()) { | |
| getLibs(f, list); | |
| continue; | |
| } | |
| if(f.getName().endsWith(".jar")) | |
| list.add(f); | |
| } | |
| } | |
| private static File findSdkRoot() { | |
| String explicitRootString = System.getProperty("appengine.sdk.root"); | |
| if(explicitRootString != null) | |
| return new File(explicitRootString); | |
| URL codeLocation = com/google/appengine/tools/info/SdkInfo.getProtectionDomain().getCodeSource().getLocation(); | |
| String msg = (new StringBuilder()).append("Unable to discover the Google App Engine SDK root. This code should be loaded from the SDK directory, but was instead loaded from ").append(codeLocation).append(". Specify ").append("-Dappengine.sdk.root to override the SDK location.").toString(); | |
| File libDir; | |
| try { | |
| libDir = new File(codeLocation.toURI()); | |
| } | |
| catch(URISyntaxException e) { | |
| libDir = new File(codeLocation.getFile()); | |
| } | |
| while(!libDir.getName().equals("lib")) { | |
| libDir = libDir.getParentFile(); | |
| if(libDir == null) | |
| throw new RuntimeException(msg); | |
| } | |
| return libDir.getParentFile(); | |
| } | |
| public static List getSharedLibs() { | |
| return sharedLibs; | |
| } | |
| public static List getSharedLibFiles() { | |
| return sharedLibFiles; | |
| } | |
| public static List getUserLibs() { | |
| return userLibs; | |
| } | |
| public static List getUserLibFiles() { | |
| return userLibFiles; | |
| } | |
| public static File getSdkRoot() { | |
| return sdkRoot; | |
| } | |
| public static Version getLocalVersion() { | |
| return (new LocalVersionFactory(getUserLibFiles())).getVersion(); | |
| } | |
| public static String getDefaultServer() { | |
| return "appengine.google.com"; | |
| } | |
| public static final String SDK_ROOT_PROPERTY = "appengine.sdk.root"; | |
| private static final String DEFAULT_SERVER = "appengine.google.com"; | |
| private static File sdkRoot; | |
| private static List sharedLibFiles; | |
| private static List sharedLibs; | |
| private static List userLibFiles; | |
| private static List userLibs; | |
| static { | |
| sdkRoot = findSdkRoot(); | |
| sharedLibFiles = Collections.unmodifiableList(getLibs(sdkRoot, "shared")); | |
| sharedLibs = Collections.unmodifiableList(toURLs(sharedLibFiles)); | |
| userLibFiles = Collections.unmodifiableList(getLibs(sdkRoot, "user")); | |
| userLibs = Collections.unmodifiableList(toURLs(userLibFiles)); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| >> import java.net.* | |
| NameError: wrong constant name JavaNet* | |
| from /Users/ted/Code/jruby/lib/ruby/1.8/irb/ruby-token.rb:102:in `get_proxy_or_package_under_package' | |
| from /Users/ted/Code/jruby/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:51:in `method_missing' | |
| from (irb):16:in `irb_binding' | |
| Maybe IRB bug!! | |
| >> import java.util.* | |
| NameError: wrong constant name JavaUtil* | |
| from /Users/ted/Code/jruby/lib/ruby/1.8/irb/ruby-token.rb:102:in `get_proxy_or_package_under_package' | |
| from /Users/ted/Code/jruby/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:51:in `method_missing' | |
| from (irb):17:in `irb_binding' | |
| Maybe IRB bug!! | |
| >> import java.security.CodeSource | |
| => Java::JavaSecurity::CodeSource | |
| >> import Java.security.ProtectionDomain | |
| NameError: cannot load Java class security.ProtectionDomain | |
| from /Users/ted/Code/jruby/lib/ruby/1.8/irb/ruby-token.rb:46:in `get_proxy_or_package_under_package' | |
| from /Users/ted/Code/jruby/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:51:in `method_missing' | |
| from (irb):19:in `irb_binding' | |
| Maybe IRB bug!! | |
| >> import java.security.ProtectionDomain | |
| => Java::JavaSecurity::ProtectionDomain | |
| >> import com.google.appengine.tools.info.SdkInfo | |
| NameError: cannot link Java class com.google.appengine.tools.info.SdkInfo, probable missing dependency: null | |
| from /Users/ted/Code/jruby/lib/ruby/1.8/irb/ruby-token.rb:46:in `get_proxy_or_package_under_package' | |
| from /Users/ted/Code/jruby/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:51:in `method_missing' | |
| from (irb):21:in `irb_binding' | |
| Maybe IRB bug!! | |
| >> import com.google.appengine.tools.info.SdkInfo | |
| NameError: cannot link Java class com.google.appengine.tools.info.SdkInfo, probable missing dependency: null | |
| from /Users/ted/Code/jruby/lib/ruby/1.8/irb/ruby-token.rb:46:in `get_proxy_or_package_under_package' | |
| from /Users/ted/Code/jruby/lib/ruby/site_ruby/1.8/builtin/javasupport/java.rb:51:in `method_missing' | |
| from (irb):22:in `irb_binding' | |
| Maybe IRB bug!! | |
| >> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment