All Questions
289
questions
69
votes
3
answers
121k
views
Create object from class in separate file
I have done several tutorials on Python and I know how to define classes, but I don't know how to use them. For example I create the following file (car.py):
class Car(object):
condition = 'New'
...
61
votes
3
answers
39k
views
Organizing Python classes in modules and/or packages
I like the Java convention of having one public class per file, even if there are sometimes good reasons to put more than one public class into a single file. In my case I have alternative ...
42
votes
13
answers
82k
views
How to run a .class file that is part of a package from cmd?
I keep getting errors when I make my .class part of a package and try to run it from cmd.
Here's the code that works after using javac and then java:
class HelloWorld {
public static void main(...
40
votes
9
answers
37k
views
Java package cycle detection: how do I find the specific classes involved? [closed]
What tool would you recommend to detect Java package cyclic dependencies,
knowing that the goal is to list explicitly the specific classes involved in the detected 'across-packages cycle'?
I know ...
40
votes
3
answers
11k
views
Why are classes inside Scala package objects dispreferred?
Starting with 2.10, -Xlint complains about classes defined inside of package objects. But why? Defining a class inside a package object should be exactly equivalent to defining the classes inside of a ...
21
votes
6
answers
15k
views
Listing of manufacturer's clock / alarm package and class name, Please add [closed]
THis is not really a question, Sorry. I just wanted help on getting the package and class names of alarm and clocks of different android makers' clock and alarm.
I have a listing here of HTC, Samsung,...
21
votes
4
answers
75k
views
Java referencing a class in the same directory
I created a Pair class in Java (similar to the c++ pair) and am having trouble referencing it from a different java file. I am working inside a Java file, let's call it fileA in the same directory as ...
17
votes
3
answers
17k
views
Is there a way to force a classloader to load a package even if none of its classes have been loaded?
Let's say a java codebase has a package called "com.example".
At runtime, we can get this Package by calling
Package p = Package.getPackage( "com.example" ); //(returns null)
or even get a list of ...
16
votes
8
answers
39k
views
android, how to get package name?
In my application I need to know the name of package name. I have no problem when I want to grab it in activities but i can't take it in other classes. Following code is working in activity but i don'...
14
votes
3
answers
11k
views
What Java classes/packages are automatically imported? [duplicate]
class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
In the above example we are using the println method without importing the ...
12
votes
1
answer
6k
views
Flex 4 two classes in one file
Can I put two or more actionscript classes in one .as file like this:
//A.as
package classes {
public class A {
public function A() {
var b:B = new B();
}
}
...
11
votes
3
answers
5k
views
Java: Use import or explicit package / class name?
I'm writing a very basic app, extending the Swing JFrame. What are the differences between making an explicit reference:
public class LineTest extends javax.swing.JFrame {
...
or importing the class ...
11
votes
5
answers
26k
views
How to find the package name given a class name?
Given a class name as a string, how do I get the package name of it at run time ? I do not have the fully qualified name with package name + class name. Simply only the class name.
I want the package ...
11
votes
3
answers
6k
views
Define Classes in Packages
I'm learning Python and I have been playing around with packages. I wanted to know the best way to define classes in packages. It seems that the only way to define classes in a package is to define ...
11
votes
1
answer
64k
views
Import some classes in same package
I want to import all the classes in a package at once, not one by one.
I tried import pckName.*; but it's not working.
Example: I have class X in package name pack1.
package pack1;
public class X {
...
9
votes
2
answers
4k
views
Java Class scope and library
I am creating a Java library, as a final product in intend to distribute this .jar to developers.
I am "translating" my library from Objective-C where I control which classes header files are ...
9
votes
1
answer
2k
views
Linking multiple files while creating a package in R
I am trying to create a package in R wherein I have created lots of new custom Classes. Each class is in a different file. The Classes inherit from a parent class and inherit to other classes.
While ...
8
votes
23
answers
58k
views
Could not find or load main class in STS/Eclipse
I have a main method in a package in one of my projects. Say, the package is com.ant.car. I am trying to run and/or debug this main method, and I keep getting the error Could not find or load main ...
8
votes
2
answers
48k
views
Spring class EnvironmentCapable
I received run-time error for string
ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml");
java.lang.NoClassDefFoundError: org/springframework/core/env/EnvironmentCapable
I ...
7
votes
1
answer
6k
views
Replace class files before maven assembly
I'm facing a very unique situation and need some advice:
I'm working on a project which depends on an other project from my same company and now I need to apply some modifications to the dependency.
...
6
votes
6
answers
49k
views
Source folder is not on the Java build class path, creating Java package
I am trying to create a package merge under sort, but it it saying that:
Source folder is not on the Java build class path
So I right click on sort folder, and try to add it to the Java build ...
6
votes
3
answers
3k
views
What are the Atom editor icon classes for Project Manager package?
What are the classes already provided by Atom editor (atom.io) like icon-squirrel to use in settings talked in project-manager package?
6
votes
1
answer
2k
views
Undefined slot classes in definition?
I am trying to build a package that contains own S4 class definitions. R check works but issues the following warning: undefined slot classes in definition mySecond.
I set to classes while one slot ...
6
votes
2
answers
8k
views
Getting the names of all Java classes declared in a package
I'm writing a functionality where it would be helpful to get the classes inside a certain package of my program. Also, I only want the classes that subclass a certain class.
I need the classes in ...
5
votes
5
answers
6k
views
Java Package Introspection [duplicate]
How do i get all classes within a package?
5
votes
2
answers
170
views
Is it possible to distribute the code of a class to several files?
Is it possible to distribute the code of a class to several files?
5
votes
2
answers
4k
views
multiple classes in ActionScript package?
I have read that you can only have one class by package in ActionScript. If you need helper classes, you have write this classes out of the package. Example:
package {
public class A {}
}
class B {...
5
votes
1
answer
171
views
What is "1;" in a Perl source? [duplicate]
Possible Duplicate:
What does 1; mean in Perl?
I'm new to Perl and learning how to build a class with Perl.
As from this example:
http://www.tutorialspoint.com/perl/perl_oo_perl.htm, I see a ...
5
votes
3
answers
1k
views
Reading all classes under a package or reading classes with same Metadata in Actionscript 3.0
I am doing an Actionscript 3.0 project which involves introspection. I am wondering if there is a way to get all the classes within a given package structure.
For e.g. Say there are three as3 ...
5
votes
2
answers
2k
views
Eclipse doesn't show classes within packages
After months of using Eclipse (latest Kepler release) on Ubuntu (13.10), after rebooting from to a sudden loss of power on my laptop, now Eclipse won't let me access java classes within their packages....
4
votes
3
answers
85k
views
how hasnext() works in collection in java
program:
public class SortedSet1 {
public static void main(String[] args) {
List ac= new ArrayList();
c.add(ac);
ac.add(0,"hai");
ac.add(1,"hw");
ac.add(2,"ai");
ac....
4
votes
3
answers
6k
views
Java not compiling .class files under $CLASSPATH
I'm trying to figure out how organize source and class files working with packages. I found a very useful tutorial. But I still have some questions.
As far as I understood it is a good practice to ...
4
votes
4
answers
4k
views
Dynamically manage two jar files with the same package and class names
I have two jar files from a client, one of which is used for a testing and another for final versions. Currently I put them in different folders and modify the library path when deploying our code, ...
4
votes
3
answers
4k
views
Why not use all imports?
I understand that I can import packages and get access to lots of already coded classes that I can use to make my programs. But if they give you access to so many different features, why not just ...
4
votes
3
answers
11k
views
class constructor cannot be accessed by outside package
so i can't find a question already asked that answers my exact problem. I have a package that i wrote in eclipse that i exported as a jar library to use in the processing ide. in processing i have a ...
4
votes
5
answers
4k
views
What about public method returns private class instance?
I am trying to test the following situation:
There is a main. (city.Main)
There is a package. (package castle)
Within the package, there is a public class (castle.Guard), and a package-private class (...
4
votes
4
answers
19k
views
Android : unresolved packages and class
in my AndroidManifest.xml, my receiver, service and activities are not found,
it should find en.company.android.name.myclass
however it says my packages(en, company, android, name) are unresolved, ...
4
votes
1
answer
64
views
How do I call the new function in R when the object is defined in another package?
Suppose I'm creating a package and I'd like to define a function that creates an object where the object is defined in another package.
For example:
get_empty_mtx <- function() return(new("...
4
votes
1
answer
2k
views
How many classes can be put in a Java package?
Is there any limit on number of Java classes(Both Public and Non Public) that can be put in a Java Package?
4
votes
2
answers
5k
views
Importing Classes from another package
Hello so I'm trying to Import a class from another project I made but I cant get it to work..
this is my code:
import program.GUI;
public class name {
//code
}
I get the following error
Opens the ...
4
votes
1
answer
99
views
Using Classes within the same named package in Java
I am trying to create two classes A and B that exist within a named package named components. A is a public class Window and B is a public class Door which contains an instance of A. The issue is that ...
3
votes
1
answer
251
views
How do you use the class method for Data.Function.Memoize?
I am working on an NP search problem and was told I can speed up the search process by using said package. Since memoisation is a new concept to me, I find it hard to wrap my head around anything ...
3
votes
1
answer
263
views
Can I just use the packages in my package diagram as the entities for my class diagram?
We need to create a booking system that allows rape victims to book sessions with a counsellor (who is a volunteer therefore is not on duty 24/7) online. The organisation used to do the booking ...
3
votes
1
answer
2k
views
Facades vs. Classes with static methods in Laravel
I was looking around the Laravel framework and some of their products and I noticed that Cashier is using the Casheir class with static methods compared to Socialite, which is used as a facade.
What ...
3
votes
3
answers
3k
views
Where does Class.forName(String className) look for the class name?
I looked on http://docs.oracle.com/javase/7/docs/api/java/lang/Class.html and saw that class.forname(String className)and "Returns the Class object associated with the class" Where does this method ...
3
votes
2
answers
8k
views
Get package names and class names for all applications
Does anyone know the class name and package name for any of these applications:
youtube
facebook
amazon mp3
google talk
camera maps
text message
dialer/phone
launcher
android market
messaging
...
3
votes
1
answer
979
views
Creating a new method for a generic from another package in R
In R, what is the simplest way to include a new method for a generic in another package? For example, the 'nlme' package has a generic called 'getData" with methods for objects of class 'lme' and '...
3
votes
2
answers
76
views
Import issues with custom python package
I have a python package that is stubbed out like this:
<main package>
|-> __init__.py
<sub package1>
|-> __init__.py
|-> admin.py
|-> <other python ...
3
votes
4
answers
943
views
Using Flash Builder to create a collection of AS3 classes
How can I set up a project in Flash Builder for creating a collection of classes that is not an application by itself? When creating an Actionscript project it forces having a main application file, ...
3
votes
1
answer
164
views
ImportError:How to import function or class from parent directory [duplicate]
I am trying to import a class from parent directory to my script but I receive attempted relative import with no known parent packageerror, I have searched everywhere in the internet but still cannot ...